Create Payment Intent API
API is used by partner to generate payment intent.
Upon successful response from the API - client receives dynamic QR code and displays it on the POS screen or the website.
URL path - /checkout/{siteId}/payment-intent
Method - POST
| Header Name |
Header Value |
Notes |
| Content-Type |
application/json |
|
| Authorization |
Bearer access_token |
Access token must have an appropriate scope to access resource |
Path Parameters
| Parameter Key |
Parameter Data Type |
Notes |
| siteId |
string |
Unique site id assigned to the Partner's site by Pyng |
Body Parameters
| Parameter Key |
Parameter Data Type |
Required |
Notes |
| amount |
integer |
Y |
Payment amount in cents. Amount must be a positive integer. Minimum value is 1 |
| orderId |
string |
N |
Unique order identifier generated by a partner |
| qrCodeFormat |
string |
N |
Format of the Qr Code. One of QrCodeFormat. Default - base64 |
Client can request QR code in one of the supported formats.
| Format |
Notes |
| base64 |
Payment intent will be returned as base64 encoded png image. Can be displayed on the screen without any extra conversions. |
| text |
Payment intent will be returned as plain text. Client has to encode received text as a QR Code to display it. |
Response
Status Code - 201 Created
| Parameter Key |
Parameter Data Type |
Required |
Notes |
| data |
object |
Y |
object of CreatePaymentIntentResponse type |
| traceId |
string |
Y |
Unique identifier of the request |
CreatePaymentIntentResponse
| Parameter Key |
Parameter Data Type |
Required |
Notes |
| qrCode |
string |
Y |
Payment intent representation in the requested format |
| paymentIntentId |
string |
Y |
Unique identifier of payment intent generated by Pyng |
| orderId |
string |
N |
Unique order identifier generated by a partner and passed in the request |
Examples
Request
POST /checkout/{siteId}/payment-intent HTTP/1.1
Host: sample.pyng.com.au
Authorization: Bearer access_token
Content-Type: application/json
{
"amount": 2500,
"orderId": "57688c4d-bf47-4cd0-a4db-b9d3e77a0269"
}
Response
HTTP/1.1 201 Created
Content-Type: application/json;charset=UTF-8
{
"data":
{
"qrCode": "data:image/png;base64,qrCode===",
"paymentIntentId": "92332209-0785-4f76-8787-ca08354f58f4"
},
"traceId": "9ae2e340-b983-4274-b400-c974a9ab40ab"
}