Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Zachary Paladino · Jul 22, 2019 at 03:44 AM · CloudScriptPlayer DataPlayer Inventory

PayPal Return Link Parameters and HTML5 Implementation

Hello!

I have a few questions on a PayPal implementation that I am doing for an HTML5 application. I am following the non-receipt payment processing flow and it is working like a charm. I just have a few questions on the PayPal return link and PlayFab Payment Confirmation steps.

The parameters that are returned from PayPal are as follows,

orderId: PayPal invoice number

playfabId: PlayFab User ID

The first question I have is should that orderId be the PayPal invoice number? Or should it be the PlayFab OrderId that is associated to the purchase? If it is supposed to be the PayPal orderId am I missing an API call where you can pass the PayPal invoice number and a PlayFab User Id to Confirm a purchase?

The reason I ask is if the payment is severed (computer crash, browser cache/local storage clear, etc) how can we recover that payment since ConfirmPurchase needs the PlayFab OrderId not the PayPal invoice. Are there any best practices for implementing PayPal IAP on an HTML5 application? My initial thoughts are,

  • Store the current purchase PlayFab OrderId in local storage to check on run for confirmation of purchase (unless cache clear)
  • Window communication from the payment page to the original window to fire off the confirmation of purchase (Only works if the original window is still there and the user did not copy and paste the confirmation link)
  • The confirmation page offers a login so that we can recover the payment and confirm the order (but that only works if we have the order number from PlayFab in the return link parameters)
  • Maybe something with CloudScript? But, I am not as familiar with that yet and I am open to suggestions

I would really like to keep my payment confirmation page static and not have to spin up an application stack for it.

Thanks for taking the time to read this and please let me know any further questions or insight you may need.

(Sorry for the double post this I don't know why it combined my drafts!)

Comment

People who like this

0 Show 2
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SethDu ♦ · Jul 23, 2019 at 09:22 AM 1
Share

I will dig into it and will discuss with the team.

avatar image Zachary Paladino SethDu ♦ · Jul 23, 2019 at 12:27 PM 0
Share

Thank you!

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by SethDu · Jul 26, 2019 at 07:18 AM

I have confirmed with our team and the PlayFab invoice ID equals to the Playfab order ID

Comment
Zachary Paladino

People who like this

1 Show 6 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Zachary Paladino · Jul 26, 2019 at 01:19 PM 0
Share

I am still seeing a different order ID return in the return link. Here is the payload from playfab PayForPurchase Return

{"code":200,"status":"OK","data":{"OrderId":"4907FC9BFC822B66","Status":"Init","VCAmount":{"GC":10},"PurchaseCurrency":"RM","PurchasePrice":1,"CreditApplied":0,"ProviderData":"EC-6WM01362BC8385748","PurchaseConfirmationPageURL":"https://www.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=EC-6WM01362BC8385748","VirtualCurrency":{"CC":150,"GC":70}}}

Here is the full return link that comes back.

https://lab.ag.com/playfab-api/src/payment.html?orderId=5262452436492233574&playfabId=52EFB16BD591EF79

That orderId matches with the PayPal invoice number but _not_ the PlayFab OrderId. When I send the invoice number via ConfirmPurchase I get a Int padding error for the ID that was given.

avatar image Zachary Paladino Zachary Paladino · Jul 26, 2019 at 01:26 PM 0
Share

Here is the payload back from ConfirmPurchase (I am using the JavascriptSDK)

{"code":400,"status":"BadRequest","error":"InvalidParams","errorCode":1000,"errorMessage":"Invalid input parameters","errorDetails":{"OrderId":["must fit within the range of UInt64"]}}
avatar image Zachary Paladino Zachary Paladino · Jul 26, 2019 at 03:31 PM 0
Share

@SethDu Sorry forgot to tag you so you would see!

avatar image SethDu ♦ Zachary Paladino · Jul 29, 2019 at 06:01 AM 1
Share

It is the same number but with different format, we have checked the source code and PlayFab stores a hexadecimal order ID while PayPal uses decimal. If you want to store/cache order IDs, do a conversion before use it.

You may confirm it via simple C# codes:

using System;
using System.Globalization;


namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			ulong reqOrderId = ToUint64("4907FC9BFC822B66");
			Console.WriteLine(reqOrderId);
			Console.ReadLine();
		}
		public static ulong ToUint64(string value)
		{
			return ulong.Parse(value, NumberStyles.HexNumber);
		}
	}
}
avatar image Zachary Paladino SethDu ♦ · Jul 29, 2019 at 02:20 PM 0
Share

Ah! This is what I was missing! Thanks! Is there any way you could add this to the PayPal documentation @SethDu Thanks!

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    ​ ​I want to have reviews for each catalog item? 1 Answer

    Is there any way to backup player data? 1 Answer

    how to get a contact email Verification Status 1 Answer

    Clone player info to other title/studio 1 Answer

    Where to store what data? - UserData, CharacterData, PlayerStatistics 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges