question

eric-3 avatar image
eric-3 asked

Problem with Facebook Payments

Hello,
I am using unity 2018.1.7f1 and facebook SDK 7.10.1

I am trying to work my way though this page here and am stuck on the FB.ui - pay step:
https://api.playfab.com/docs/tutorials/landing-commerce/non-receipt-payment-processing

FB.ui isn't in the documentation anymore (https://developers.facebook.com/docs/unity/reference/current) and generates syntax errors in Unity when I try to use it.

Is there another method I can use to send payment information to Facebook? I tried to use FB.Canvas.Pay, but it fails (probably because there is no place to send the request_id).

Is there perhaps a more up to date code example, or am I missing something?

Thank you.

1 comment
10 |1200

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

Andy avatar image Andy ♦♦ commented ·

It wouldn't surprise me if that doc is out of date. I'll do some digging to try to find out the current correct flow for Facebook, but I may not get to it until Monday. You're welcome to do some digging through the Facebook SDK yourself in the meantime. :)

0 Likes 0 ·

1 Answer

·
brendan avatar image
brendan answered

The FB.Canvas.Pay docs (https://developers.facebook.com/docs/unity/reference/current/FB.Canvas.Pay/) state that it is a wrapper on FB.ui, and that it does have a requestId parameter you would use in place of request_id, so yes, that should be the correct call to use.

What is your Title ID, what specific parameters are you passing in, and what is the error you get back?

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

eric-3 avatar image eric-3 commented ·
Oops! totally missed the request_id in the docs. Here is what I am trying now:
(I'm using the catalog I set up for steam purchases)

void FacebookPayForPurchase(string OrderId){

	FB.Canvas.Pay(
	"https://e8af.playfabapi.com/OpenGraphProduct/e8af//Steam%20Catalog%201/10_gem	s",
	"purchaseitem",
	1,
	null, null, 
	OrderId, 
	null, null,
	this.payCallback
	);
}

However, I get back this:
{"payment_id":null, "amount":null, "APP-ID":null, "cerrency"null, "developer_payload":null, "error_code":1383146, "error_message":invalid ogtype.Expected og:product, got website", "product_id":null, purchase_time":"0", "purchase_token":null}

I'm hoping I just have my product url wrong.
Thanks for your help!
0 Likes 0 ·
Andy avatar image Andy ♦♦ eric-3 commented ·

It looks like the product may not be properly configured in Facebook and that there is a problem with the URL you're providing. Your URL is definitely missing a StoreId. Beyond that, it'd be worth verifying you have the right url by testing using a GET request as described here: https://developers.facebook.com/docs/payments/product/.

0 Likes 0 ·
eric-3 avatar image eric-3 Andy ♦♦ commented ·

I have this set up using webhooks payments object. Testing the Callback URL (https://E8AF.playfabapi.com/ThirdPartyPayments/FacebookPaymentUpdate) is successful. Is there a step beyond setting up the product in playfab that I need to do?

I have read this post here (https://community.playfab.com/questions/658/208334967-Facebook-canvas-payment.html) to try and figure out what my product URL should be, and it looks like it should be formed like this: https://{ {TitleId}}.playfabapi.com/OpenGraphProduct/{ {TitleId}}/{ {StoreId}}/{ {CatalogId}}/{ {ItemId}}

my title id is e8af
Catalog ID is U3RlYW0gQ2F0YWxvZyAx
Item ID is MTAgR2Vtcw%3D%3D

I don't have a store ID, since I'm not using them.I'm not sure what to do about it. Is there a null value I'm supposed to send?

I can use this page to scrape the product URL: https://developers.facebook.com/tools/debug/og/object/

I have tried several different urls, including https://e8af.playfabapi.com/OpenGraphProduct/e8af/U3RlYW0gQ2F0YWxvZyAx/MTAgR2Vtcw%3D%3D

but all I ever get back is a 404 response.

How should the product URL look?

0 Likes 0 ·
Show more comments

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.