question

Matt Sullivan avatar image
Matt Sullivan asked

Facebook Purchase Webhooks

We're attempting to port one of our unity games over to WebGL and have it play as a facebook app.  We've got saving functioning but now we're at the point of adding in app purchase support and were wondering if there's any way to setup playfab as a purchase callback system.  

From the facebook documentation here: https://developers.facebook.com/docs/payments/realtimeupdates we need to provide a callback url and a verification token that would handle purchase validation.  

I haven't seen anything like this in the playfab api but if it was supported functionality it would help us out greatly.  

Thanks

10 |1200

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

brendan avatar image
brendan answered

To set up Facebook payments, you need to enter your App ID, App Secret, and email for disputes on the Facebook Add-ons page. Just click on "Add-ons" in the Game Manager, scroll down to the Facebook entry, and click on it to see all the info on our Add-on setup for Facebook.

For Canvas apps, you set the Callback URL as:

https://{ {TitleId}}.playfabapi.com/ThirdPartyPayments/FacebookPaymentUpdate

Where { {TitleId}} is the Title ID for your game in PlayFab (for example, https://aaa.playfabapi.com/ThirdPartyPayments/FacebookPaymentUpdate).

You do not need a token when using PlayFab for purchasing with a Canvas title.

10 |1200

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

Matt Sullivan avatar image
Matt Sullivan answered

We aren't using paypal so I'm not sure how that comes into play.  On the facebook app page it's asking for a Callback URL for their Payments Object that they'll use to post purchase information to be handled by a server.  The url they call looks would look like http://billing-facilitator_api1.playfab.com?hub.mode=subscribe&hub.challenge=775721099&hub.verify_token=YourToken and would expect a response of 775721099.  Is the billing-facilitator_api a possible callback url for this or is it only to handle paypal info?

Thanks

10 |1200

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

brendan avatar image
brendan answered

Yes, apologies for the confusion. I've updated the original response to clarify this - the issue is that we're in progress on a tutorial for purchasing with the StartPurchase flow right now, and happen to be on the PayPal part of the story, hence crossing the streams.

For Facebook purchases, you just enter the App ID, App Secret, and dispute email. The Callback URL and Token are things you set in your App Dashboard (https://developers.facebook.com/apps) if your title is a Canvas app.

10 |1200

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

Matt Sullivan avatar image
Matt Sullivan answered

Right, we just want to know if we can set the callback url to point towards playfab rather than having our own server as an in between step.

10 |1200

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

brendan avatar image
brendan answered

Ah, I see - and thanks for calling this out, as I do see that our main docs are missing this key element. The info is that you set this as your Callback URL:

https://{ {TitleId}}.playfabapi.com/ThirdPartyPayments/FacebookPaymentUpdate

Where { {TitleId}} is your game's ID in our service. You don't need a token, as we haven't required one.

I've updated the main response, so that all the info is at the top of this thread, and I'll make sure the docs get updated.

10 |1200

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

Matt Sullivan avatar image
Matt Sullivan answered

Awesome, thanks.  We'll be taking a look at this over the next few days to see how it all works.

10 |1200

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

mvalero avatar image
mvalero answered

Hi guys, I have a problem with Facebook purchases. I created a bundle with a few virtual coins. the idea is that user buy a bundle of virtual coin and use to buy stuff in game. I'm doing the following step: start purchase->buy over facebook canvas->PayForPurchase->confirmpurchase. all works fine and a can see the bundle in inventory's player .the problem is that the virtual currency is not added to the user account. I'm missing an step in the process?. I'm used unity webGL and facebook canvas.

2 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.

brendan avatar image brendan commented ·

What's are: the Title ID, PlayFab ID of the test user, and Item ID of the bundle in the catalog?

0 Likes 0 ·
mvalero avatar image mvalero brendan commented ·

titleID:7377 Playfab ID:F096028ACD293CBF item ID: A1A34CE77936E4FC

0 Likes 0 ·
brendan avatar image
brendan answered
@mvalero

I'm seeing a number of changes to that bundle in your title's audit log, and while it's set as a Durable currently, I'm also seeing a previous event that shows a player consumed a use from it, so it must have been a Consumable at some previous point. Are you able to reproduce this currently? Do you mind if I create a player in your title and try a few tests?

Also, I highly recommend making these bundles Consumable by time, with a 5 second timeout so that they get cleaned up after delivering their contents. Otherwise, you'll have players hitting the inventory item list as these stack up in their inventories.

10 |1200

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

mvalero avatar image
mvalero answered

Brendan. yes you can create a player and run the test that you need. I'm going to change the bundle to consumable and set time to 5 seconds. then I'm going to test again.

10 |1200

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

brendan avatar image
brendan answered
@mvalero

It looks like the Product isn't set correctly in your call to FB.ui. Can you have a look at this post (https://community.playfab.com/questions/658/208334967-Facebook-canvas-payment.html) and confirm how you're setting the Product?

2 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.

mvalero avatar image mvalero commented ·

yes, you have right. the product URL was bad formatted.https://{ {TitleId}}.playfabapi.com/OpenGraphProduct/{ {TitleId}}/{ {StoreId}}/{ {CatalogId}}/{ {ItemId}} . I was missing the store ID. thanks for you help.

0 Likes 0 ·
brendan avatar image brendan mvalero commented ·

You're quite welcome! I should point out as well that if you don't use stores, you can just leave the StoreId as "none", and it'll work fine.

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.