Making a test payment: Difference between revisions
Jump to navigation
Jump to search
(first iteration. to-do: images, json formatting) |
(fixed code block) |
||
Line 13: | Line 13: | ||
# Log in to [https://secure.test.barion.com to your Barion shop]. | # Log in to [https://secure.test.barion.com to your Barion shop]. | ||
# Click through to Shops>Actions>Details>Secret Key (POSKey), and copy the value to the clipboard. [[File:/img/getting-started/posKey-1.png|Finding your shop’s POSKey]] ''Finding your shop’s POSKey'' | # Click through to Shops>Actions>Details>Secret Key (POSKey), and copy the value to the clipboard. [[File:/img/getting-started/posKey-1.png|Finding your shop’s POSKey]] ''Finding your shop’s POSKey'' | ||
# Start the Postman Desktop agent, and make a POST call to <code>https://api.test.barion.com/v2/payment/start</code>, passing the following JSON in the request body: Replace the <code>POSKey</code> and the <code>Transactions</code>/<code>Payee</code> as indicated.< | # Start the Postman Desktop agent, and make a POST call to <code>https://api.test.barion.com/v2/payment/start</code>, passing the following JSON in the request body: Replace the <code>POSKey</code> and the <code>Transactions</code>/<code>Payee</code> as indicated. | ||
<syntaxhighlight lang="json">{ | |||
"POSKey": "[the POSKey you've just copied]", | |||
"PaymentType": "Immediate", | |||
"PaymentRequestId": "DEV-TEST-615", | |||
"FundingSources": ["All"], | |||
"OrderNumber": "Order_01", | |||
"RedirectUrl": "https://example.com/", | |||
"Currency": "EUR", | |||
"Locale":"en-US", | |||
"GuestCheckOut": true, | |||
"PaymentWindow":"00:30:00", | |||
"Transactions": [ | |||
{ | { | ||
"POSTransactionId": "DEV-TEST-01-01", | |||
"Payee": "[the email address associated with the Barion shop]", | |||
"Total": 100, | |||
"Comment": "Test transaction", | |||
"Items": [ | |||
{ | { | ||
"Name": "Nada", | |||
"Description": "Zilch", | |||
"Quantity": 1, | |||
"Unit": "db", | |||
"UnitPrice": 1, | |||
"ItemTotal": 1, | |||
"SKU": "SM-01" | |||
} | } | ||
] | ] | ||
} | } | ||
] | ] | ||
}</ | }</syntaxhighlight>For details on the various parameters you’re passing in the call, see [[05-api-reference/01-payment-resource/01-payment-start|the <code>Payment/Start</code> API endpoint reference]].<blockquote>Step result: The API request returns the following JSON: <br /><syntaxhighlight lang="json">{ "PaymentId": [the payment ID generated for the transaction], "PaymentRequestId": "DEV-TEST-187", "Status": "Prepared", "QRUrl": "<nowiki>https://api.test.barion.com/qr/generate?paymentId=</nowiki>[the payment ID generated for the transaction]&size=Large", "Transactions": [ { "POSTransactionId": "DEV-TEST-01-01", "TransactionId": [the payment ID generated for the transaction], "Status": "Prepared", "Currency": "EUR", "TransactionTime": "0001-01-01T00:00:00", "RelatedId": null } ], "RecurrenceResult": "None", "ThreeDSAuthClientData": null, "GatewayUrl": "<nowiki>https://secure.test.barion.com/Pay?Id=2</nowiki>[the payment ID generated for the transaction]", "RedirectUrl": "<nowiki>http://barion.com/?paymentId=</nowiki>[the payment ID generated for the transaction]", "CallbackUrl": "", "TraceId": null, "Errors": [] }</syntaxhighlight></blockquote> | ||
== Pay through the Barion Smart Gateway: == | == Pay through the Barion Smart Gateway: == |
Revision as of 04:27, 7 August 2024
Get a feel for how Barion works by using the Barion Gateway API to
- set up a payment for the Barion shop you’ve created, and
- settle the payment with some test money from your Barion Wallet.
Prerequisites
- Completing the first part of this tutorial.
- An API testing tool such as Postman
Make a test payment using the Barion API
- Log in to to your Barion shop.
- Click through to Shops>Actions>Details>Secret Key (POSKey), and copy the value to the clipboard. Finding your shop’s POSKey Finding your shop’s POSKey
- Start the Postman Desktop agent, and make a POST call to
https://api.test.barion.com/v2/payment/start
, passing the following JSON in the request body: Replace thePOSKey
and theTransactions
/Payee
as indicated.
{
"POSKey": "[the POSKey you've just copied]",
"PaymentType": "Immediate",
"PaymentRequestId": "DEV-TEST-615",
"FundingSources": ["All"],
"OrderNumber": "Order_01",
"RedirectUrl": "https://example.com/",
"Currency": "EUR",
"Locale":"en-US",
"GuestCheckOut": true,
"PaymentWindow":"00:30:00",
"Transactions": [
{
"POSTransactionId": "DEV-TEST-01-01",
"Payee": "[the email address associated with the Barion shop]",
"Total": 100,
"Comment": "Test transaction",
"Items": [
{
"Name": "Nada",
"Description": "Zilch",
"Quantity": 1,
"Unit": "db",
"UnitPrice": 1,
"ItemTotal": 1,
"SKU": "SM-01"
}
]
}
]
}
For details on the various parameters you’re passing in the call, see the Payment/Start
API endpoint reference.
Step result: The API request returns the following JSON:
{ "PaymentId": [the payment ID generated for the transaction], "PaymentRequestId": "DEV-TEST-187", "Status": "Prepared", "QRUrl": "<nowiki>https://api.test.barion.com/qr/generate?paymentId=</nowiki>[the payment ID generated for the transaction]&size=Large", "Transactions": [ { "POSTransactionId": "DEV-TEST-01-01", "TransactionId": [the payment ID generated for the transaction], "Status": "Prepared", "Currency": "EUR", "TransactionTime": "0001-01-01T00:00:00", "RelatedId": null } ], "RecurrenceResult": "None", "ThreeDSAuthClientData": null, "GatewayUrl": "<nowiki>https://secure.test.barion.com/Pay?Id=2</nowiki>[the payment ID generated for the transaction]", "RedirectUrl": "<nowiki>http://barion.com/?paymentId=</nowiki>[the payment ID generated for the transaction]", "CallbackUrl": "", "TraceId": null, "Errors": [] }
Pay through the Barion Smart Gateway:
Go to the URL in the POST call’s GatewayURL
return value, and complete the purchase using the following test card details:
- Card number: 4444 8888 8888 5559
- Expiration date: any future date
- CVC: any 3-digit number
![The Test Payment Gateway for Your API-prompted Transaction](/img/getting-started/gatewayUrl.png) *The Test Payment Gateway for Your API-prompted Transaction*