Request single payment

1. Get payment token

Start by generating a payment token. Make a HTTP POST request to the relevant endpoint + /api/oauth/token/ using the access token you generated.

Request

curl --location --request POST 'https://uat.app.payvyne.com/api/oauth/token' 
--header 'Content-Type: application/x-www-form-urlencoded' 
--data-urlencode 'grant_type=client_credentials' 
--data-urlencode 'client_id=<payment_key>'
--data-urlencode 'client_secret=<payment_secret>’

👍

Try it out

If your request was successful you will receive a payment token like this in the response eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudElkIjoxLCJzY29wZSI6WyJwYXkiXSwiaXNzIjoiaHR0cDovL2FwcC5kZXYucGF5dnluZS5zeXN0ZW1zIiwiZXhwIjoxNTg2MzY5NzExLCJpYXQiOjE1ODYzNjYxMTEsImF1dGhvcml0aWVzIjpbIlJPTEVfUEFZIl0sImp0aSI6ImExY2UzZjdmLTE3MzItNDhmNC04NTI3LTA5NWQ5NjlhNjkzNSIsImNsaWVudF9pZCI6IllNUFE2aDZQYTNaYmpEMXplbkQ0eXcifQ.g3XSXftyHvlCL1z1tlW6khboY7hzbiZVZgIzKHF2Rdc

2. Create payment request

Then, create a PIRPIR - Payment Initiation Request. Send an HTTP POST request to the relevant endpoint + /api/v1/payments/ including the header Authorization: Bearer <payment_token>. You can use the same payment token generated in the first step.

Request

curl --location --request POST 'https://uat.app.payvyne.com/api/v1/payments'
--header 'Authorization: Bearer <payment_token>'
--header 'Content-Type: application/json'
--data-raw '{
    "amount": "5.95",
    "currency": "GBP",
    "destinationAccount": "GBP1",
    "description": "Web payment",
    "callbackUrl": "yoursite.com/payment-outcome-page",
    "mediaType": "URL",
    "countries": ["GB"],
    "customerReference": "123",
    "merchantReference": "ABC"
}'

Parameter

Description

amount

Amount to be paid.

currency

The three-character payment currency using ISO 4217. Vyne supports GBP and EUR.

destinationAccount

Specifies the ID of the merchant's destination bank account (e.g. GBP1). More on bank accounts here. Use this to specify a settlement account in order to use confirmation of funds received, refunds, and payouts.

description

An internal description - can be up to 250 characters alphanumeric.

callbackUrl

The URL the payer will be redirected back to after the authorisation is completed.

mediaType

Specifies if the response should contain a URL to the payment page or a QR code. Accepted values are QR and URL. Default value is URL.

countries

Specifies the countries of which banks are available on the bank selection page. Default value is GB.

customerReference

Reference field for customer ID - can be up to 128 characters alphanumeric. Optional field, but required for use of payouts.

merchantReference

Reference field for order ID - can be up to 256 characters and alphanumeric.

serviceType

Distinguishes between EUR connections supporting SCT (standard) and SCT Inst (enhanced) payments. Default value is enhanced. Not required for GBP payments.

A successful PIRPIR - Payment Initiation Request returns a 202 response code and an object.

If something unexpected happened during the request, the API returns an error response with the appropriate HTTP status code and a JSON response that contains detailed information about the problem.

Response

{
  "redirectUrl": "<redirect_url>",
  "qrCodeUrl": "<qr_code_url>",
  "requestId": "adca2b6a077de1f5",
  "mediaType": "URL"
}

Parameter

Description

redirectUrl

The URL of the hosted checkout page to be presented to consumers. This value is returned when mediaType is URL.

qrCodeUrl

The URL of the QR code which encodes the URL of the payment page. This value is returned when mediaType is QR.

requestId

16 digit alphanumeric unique payment identifier.

mediaType

Specifies the format the payment link was generated. Possible values URL and QR.

🚧

Be aware

For security, the URL and QR code are only valid for 30 minutes after the Payment Initiation Request was created.

3. Bank selection and consent

Redirect your consumer using the URL or QR code provided in the PIRPIR - Payment Initiation Request redirectUrl response. For example, use the URL to redirect users in your application, send the URL as a link in an e-mail, or present the QR code for the consumer to scan on their device. Understand more about how the hosted checkout works and its use cases here.


Did this page help you?