question

shyam avatar image
shyam asked

Dynamic pricing while using PayPal in Unity with PlayFab

Hi,

How can I set the price at runtime while using PayPal in Unity with PlayFab?

I found the PurchaseItemRequest() API which has a input parameter Price. Can this be used for PayPal?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Andy avatar image
Andy answered

The PayPal payment flow uses StartPurchase and PayForPurchase, not PurchaseItem. Those APIs do not support client-side price overrides. From a spoofing and tampering perspective, you probably wouldn't want them to anyway.

Can you go into more detail as to why you'd need client-side overrides? The Monetization features built into PlayFab allow for fairly dynamic store pricing options.

15 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shyam avatar image shyam commented ·

Sorry @Andy. I glossed over the fact that we could specify the quanity of items that player needs to buy in the StartPurchase API. By setting a base price for the item I would be able to change the total price by altering the quantitiy parameter. Is this understanding correct?

0 Likes 0 ·
Andy avatar image Andy ♦♦ shyam commented ·

Absolutely. For each item in the payload of the StartPurchase call you can set a quantity. We would then, when you call PayForPurchase, calculate the amount to charge the player.

1 Like 1 ·
Andy avatar image Andy ♦♦ Andy ♦♦ commented ·

@shyam, Your previous comment disappeared, but I think you were asking about problems you encountered setting a quantity on a cart item. You can share more details?

  • What title?
  • What Item?
  • What was the desired quantity?
  • What was the precise error you're seeing?
0 Likes 0 ·
Show more comments
shyam avatar image shyam commented ·

The payment that is made in our app will be greater than or equal to $0.01. So for $6.58 the quantity parameter will be 658. Can the limit be increased? How to use bundles in this scenario?

0 Likes 0 ·
shyam avatar image shyam shyam commented ·

The error obtained when quantity exceeds 25 is given below.

/Client/StartPurchase PlayFabError(InvalidParams, Invalid quantity in cart: item ID=Spot, 400 BadRequest
0 Likes 0 ·
Andy avatar image Andy ♦♦ shyam commented ·

The limit is a global limit and cannot be increased for your title. A bundle is a collection of items and quantities in a catalog that are made available at a fixed price on a store. There's more information about them here: https://api.playfab.com/docs/tutorials/landing-commerce/catalogs. So, for instance, you could have a bundle of 500 instances of your item and price it at $5.00. Then, when you call StartPurchase, you only need to pass in the bundle and a quantity of one, instead of the individual item and a quantity of 500.

0 Likes 0 ·
Show more comments
shyam avatar image shyam commented ·
1. What is your target platform?

Android and iOS devices

2. Who is your payment provider?

Paypal

3. What is the experience of a player selecting items for a "cart"?

I am not able to understand this question.

4. What exactly is the player buying? Is it VC?

There are weekly contests and to play the contest they need to spend real money. The contest prices will be different for each contest.

5. What is the Title ID? Looking at your setup may yield more info.

Title ID is 9C99.

0 Likes 0 ·
brendan avatar image brendan shyam commented ·

Then I'm completely at a loss. You cannot use the StartPurchase flow on iOS and Android - you have to use their marketplace for all real-world purchases. You would then use our receipt validation calls to check that the purchases are unique and valid, and to add the items to the player account. Apple in particular are very specific about this - there are some limited markets where you can use external payment providers on Android, but that's really the exception.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.