Player Item Management - Pay For Purchase
NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new Economy features are being developed only for version 2. Selects a payment option for purchase order created via StartPurchase
POST https://titleId.playfabapi.com/Client/PayForPurchase
Request Header
Name | Required | Type | Description |
---|---|---|---|
X-Authorization | True |
string |
This API requires a client session ticket, available from any Client Login function. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
Currency | True |
string |
Currency to use to fund the purchase. |
OrderId | True |
string |
Purchase order identifier returned from StartPurchase. |
ProviderName | True |
string |
Payment provider to use to fund the purchase. |
CustomTags |
object |
The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). |
|
ProviderTransactionId |
string |
Payment provider transaction identifier. Required for Facebook Payments. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
For web-based payment providers, this operation returns the URL to which the user should be directed inorder to approve the purchase. Items added to the user inventory as a result of this operation will be marked as unconfirmed. |
|
400 Bad Request |
This is the outer wrapper for all responses with errors |
Security
X-Authorization
This API requires a client session ticket, available from any Client Login function.
Type:
apiKey
In:
header
Definitions
Name | Description |
---|---|
Api |
The basic wrapper around every failed API response |
Pay |
This is the second step in the purchasing process, initiating the purchase transaction with the payment provider (if applicable). For payment provider scenarios, the title should next present the user with the payment provider'sinterface for payment. Once the player has completed the payment with the provider, the title should call ConfirmPurchase tofinalize the process and add the appropriate items to the player inventory. |
Pay |
For web-based payment providers, this operation returns the URL to which the user should be directed inorder to approve the purchase. Items added to the user inventory as a result of this operation will be marked as unconfirmed. |
Transaction |
ApiErrorWrapper
The basic wrapper around every failed API response
Name | Type | Description |
---|---|---|
code |
integer |
Numerical HTTP code |
error |
string |
Playfab error code |
errorCode |
integer |
Numerical PlayFab error code |
errorDetails |
object |
Detailed description of individual issues with the request object |
errorMessage |
string |
Description for the PlayFab errorCode |
status |
string |
String HTTP code |
PayForPurchaseRequest
This is the second step in the purchasing process, initiating the purchase transaction with the payment provider (if applicable). For payment provider scenarios, the title should next present the user with the payment provider'sinterface for payment. Once the player has completed the payment with the provider, the title should call ConfirmPurchase tofinalize the process and add the appropriate items to the player inventory.
Name | Type | Description |
---|---|---|
Currency |
string |
Currency to use to fund the purchase. |
CustomTags |
object |
The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). |
OrderId |
string |
Purchase order identifier returned from StartPurchase. |
ProviderName |
string |
Payment provider to use to fund the purchase. |
ProviderTransactionId |
string |
Payment provider transaction identifier. Required for Facebook Payments. |
PayForPurchaseResult
For web-based payment providers, this operation returns the URL to which the user should be directed inorder to approve the purchase. Items added to the user inventory as a result of this operation will be marked as unconfirmed.
Name | Type | Description |
---|---|---|
CreditApplied |
number |
Local credit applied to the transaction (provider specific). |
OrderId |
string |
Purchase order identifier. |
ProviderData |
string |
Provider used for the transaction. |
ProviderToken |
string |
A token generated by the provider to authenticate the request (provider-specific). |
PurchaseConfirmationPageURL |
string |
URL to the purchase provider page that details the purchase. |
PurchaseCurrency |
string |
Currency for the transaction, may be a virtual currency or real money. |
PurchasePrice |
number |
Cost of the transaction. |
Status |
Status of the transaction. |
|
VCAmount |
object |
Virtual currencies granted by the transaction, if any. |
VirtualCurrency |
object |
Current virtual currency balances for the user. |
TransactionStatus
Name | Type | Description |
---|---|---|
Approved |
string |
|
ChargedBack |
string |
|
CreateCart |
string |
|
DisputePending |
string |
|
Failed |
string |
|
FailedByPlayFab |
string |
|
FailedByProvider |
string |
|
FailedByUber |
string |
|
Init |
string |
|
Other |
string |
|
RefundFailed |
string |
|
RefundPending |
string |
|
Refunded |
string |
|
Revoked |
string |
|
StackPending |
string |
|
Stacked |
string |
|
Succeeded |
string |
|
TradePending |
string |
|
Traded |
string |
|
Upgraded |
string |
Error Codes
Name | Code |
---|---|
DuplicatePurchaseTransactionId | 1489 |
FailedByPaymentProvider | 1015 |
InsufficientFunds | 1059 |
InvalidPaymentProvider | 1063 |
InvalidPurchaseTransactionStatus | 1081 |
PurchaseDoesNotExist | 1080 |
PurchaseInitializationFailure | 1064 |