Anchor | ||||
---|---|---|---|---|
|
Create Repeat Payment using MOTO
Create a repeat payment schedule.
A schedule can either be on a Variable or Fixed basis
POST /pay/v1/repeat-payments
Headers
Content-Typestring
Content type.
Authorizationstring
Access token generated from create token request.
Attributes - (Required for all schedules)
payment_typestring
Repeat payment type. It must be either of the following values.
fixed_schedule
variable_schedule
payment_intentstring
Payment intent generated from create intent request.
paymentTokenstring
Tokenised card value. In create intent response, ccElement
will be returned in element array if repeat payment is enabled for that merchant account. User can populate ccElement
as a part of the create repeat request form to generate and pass paymentToken value. Please go through the process from payment page, to generate paymentToken.
customer_namestring
Customer name.
customer_emailstring
Customer email.
referencestring
Reference value. Unique textual details of the schedule
customer_addressstring
Customer address.
customer_postcodestring
Customer postcode.
currencystring
Currency that the payments will be processed in
Specific fields for a Fixed schedule - (These cannot be used in conjunction with the below Variable schedule specific fields)
frequencystring
Payment cycle frequency. It is required when creating a Fixed Schedule.
Possible values are
days
weeks
months
frequency_durationinteger
Payment frequency duration. It is required when creating a Fixed Schedule.
(E.g. “2” and “days” will be every 2 days)
start_payment_datedate
Date on which the first payment will be captured.
It is required when creating a Fixed Schedule.
Default value set to today.
first_amountdecimal (optional)
First payment amount.
When creating a Fixed Schedule, the first amount value can be customised.
recurring_amountdecimal
Recurring amount for each instalment. It is required when creating a Fixed Schedule.
is_limited_installments boolean
When creating a Fixed Schedule, it is required to mention if the schedule will have unlimited or limited instalments.
Possible values are
true
false
installmentsinteger
Number of installments.
It is required when creating a Fixed Schedule if the is_limited_installments field is true (i.e. it has limited instalments)
If is_limited_installments is true, then these 2 fields can also be added |
---|
final_amountdecimal (optional) final_payment_datedate (optional) |
Specific fields for a Variable schedule - (This cannot be used in conjunction with any of the above Fixed schedule specific fields)
schedule_setarray
Schedule set is a array set of date and amount where the date will be the key and the amount will be its value.
It is required for Variable Schedule payment. This array needs to have minimum 2 set of values.
Request for fixed schedule
Code Block |
---|
POST https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... { "payment_type": "fixed_schedule", "payment_intent": "pi_rj..........", "customer_name": "Test developer", "customer_email": "test@gmail.com", "reference": "schedule payment with limited installments", "customer_address": "Uk....", "customer_postcode": "119083", "frequency": "days", "frequency_duration": 1, "currency": "GBP", "first_amount": 20.03, "recurring_amount": 15.01, "final_amount": 10.08, "is_limited_installments": true, "installments": 3, "start_payment_date": "23-02-2023", "final_payment_date": "25-02-2023", "paymentToken": "ey............" } |
Response
Code Block |
---|
HTTP/1.1 201 Created Content-Type: application/json { "id": 123, "payment_type": "fixed_schedule", "status": "active", "customer_name": "Test developer", "customer_email": "test@gmail.com, "reference": "schedule payment with limited installments", "address": "Uk....", "postcode": "119083", "currency": "GBP", "start_payment_date": "23-02-2023", "final_payment_date": "25-02-2023", "recurring_amount": "15.01", "is_limited_installments": true, "installments": 3, "frequency": "days", "frequency_duration": 1, "is_active": "true", "recurring_data": { "recurring_id": 1, "payment_date": "23-02-2023", "reference": "Payment 1" "processed_amount": 20.03, "is_processed": true, "status": "captured", "xref": "AKY........." }, { "recurring_id": 2, "payment_date": "24-02-2023", "reference": "Payment 2" "processed_amount": 15.01, "is_processed": false, "status": "pending", "xref": "AKY........." }, { "recurring_id": 3, "payment_date": "25-02-2023", "reference": "Payment 3" "processed_amount": 10.08, "is_processed": false, "status": "pending", "xref": "AKY........." } } |
Request for variable schedule
Code Block |
---|
POST https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... { "payment_type": "variable_schedule", "payment_intent": "pi_rj..........", "customer_name": "Test developer", "customer_email": "test@gmail.com", "reference": "variable schedule", "customer_address": "Uk....", "customer_postcode": "119083", "currency": "GBP", "paymentToken": "ey............", "schedule_set": { "13-02-2023": 20.02, "16-02-2023": 22.02, "25-02-2023": 26.02 } } |
Response
Code Block |
---|
HTTP/1.1 201 Created Content-Type: application/json { "id": 123, "payment_type": "variable_schedule", "status": "active", "customer_name": "Test developer", "customer_email": "test@gmail.com, "reference": "variable schedule", "address": "Uk....", "postcode": "119083", "currency": "GBP", "start_payment_date": "13-02-2023", "final_payment_date": "25-02-2023", "recurring_amount": null, "is_limited_installments": false, "installments": null, "frequency": "N/A" "frequency_duration": "N/A" "is_active": true, "recurring_data": { "recurring_id": 1, "payment_date": "13-02-2023", "reference": "Payment 1" "processed_amount": 20.02, "is_processed": true, "status": "captured", "xref": "AKY........." }, { "recurring_id": 2, "payment_date": "16-02-2023", "reference": "Payment 2" "processed_amount": 22.02, "is_processed": false, "status": "pending", "xref": "AKY........." }, { "recurring_id": 3, "payment_date": "25-02-2023", "reference": "Payment 3" "processed_amount": 26.02, "is_processed": false, "status": "pending", "xref": "AKY........." } } |
Anchor | ||||
---|---|---|---|---|
|
Create Repeat Payment Using ECOM
Create a repeat payment schedule.
A schedule can either be on a Variable or Fixed basis
POST /pay/v1/repeat-payments
Headers
Content-Typestring
Content type.
Authorizationstring
Access token generated from create token request.
User-Agentstring
User agent.
Acceptstring
Accept
Accept-Encodingstring
Accept encoding.
Accept-Charsetstring
Accept charset.
Attributes - (required for all schedules)
payment_typestring
Repeat payment type. It must be either of the following values.
fixed_schedule
variable_schedule
payment_intentstring
Payment intent generated from create intent request.
paymentTokenstring
Tokenised card value. In create intent response, ccElement
will be returned in element array if repeat payment is enabled for that merchant account. User can populate ccElement
as a part of the create repeat request form to generate and pass paymentToken value. Please go through the process from payment page, to generate paymentToken.
customer_namestring
Customer name.
customer_emailstring
Customer email.
referencestring
Reference value. Unique textual details of the schedule
customer_addressstring
Customer address.
customer_postcodestring
Customer postcode.
currencystring
Currency that the payments will be processed in
Specific fields for a Fixed schedule - (These cannot be used in conjunction with the below Variable schedule specific fields)
frequencystring
Payment cycle frequency. It is required when creating a Fixed Schedule.
Possible values are
days
weeks
months
frequency_durationinteger
Payment frequency duration. It is required when creating a Fixed Schedule.
(E.g. “2” and “days” will be every 2 days)
start_payment_datedate
Date on which the first payment will be captured.
It is required when creating a Fixed Schedule.
Default value set to today.
first_amountdecimal (optional)
First payment amount.
When creating a Fixed Schedule, the first amount value can be customised.
recurring_amountdecimal
Recurring amount for each instalment. It is required when creating a Fixed Schedule.
is_limited_installments boolean
When creating a Fixed Schedule, it is required to mention if the schedule will have unlimited or limited instalments.
Possible values are
true
false
installmentsinteger
Number of installments.
It is required when creating a Fixed Schedule if the is_limited_installments field is true (i.e. it has limited instalments)
If is_limited_installments is true, then these 2 fields can also be added |
---|
final_amountdecimal (optional) final_payment_datedate (optional) |
Specific fields for a Variable schedule - (This cannot be used in conjunction with any of the above Fixed schedule specific fields)
schedule_setarray
Schedule set is a array set of date and amount where the date will be the key and the amount will be its value.
It is required for Variable Schedule payment. This array needs to have minimum 2 set of values.
Specific fields for ECOM
device_timezoneinteger
Device timezone value which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
device_capabilitiesstring
Device capabilities which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
device_accept_languagestring
Device accept language which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
device_screen_resolutionstring
Device accept language which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
remote_addressstring
Remote address which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
Request for fixed schedule
Code Block |
---|
POST https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... User-Agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36", Accept: "*/*" Accept-Encoding: "gzip, deflate, br" Accept-Charset: "" { "payment_type": "fixed_schedule", "payment_intent": "pi_rj..........", "customer_name": "Test developer", "customer_email": "test@gmail.com", "reference": "fixed schedule payment with unlimited installments", "customer_address": "Uk....", "customer_postcode": "119083", "frequency": "days", "frequency_duration": 1, "currency": "GBP", "recurring_amount": 15.01, "is_limited_installments": false, "start_payment_date": "23-02-2023", "paymentToken": "ey............", "device_timezone" : "-330", "device_capabilities" : "javascript", "device_accept_language" : "en-GB", "device_screen_resolution" : "1366x768x24", "remote_address" : "123.123.123.123" } |
Response
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json { "acsform": "<form id="form3ds22" method="post" action="https://acs.********"><input type="hidden" name="creq" value="********"> <input type="hidden" name="threeDSPageSessions[427**************][bfreq]" value="*******"> <input type="hidden" name="threeDSPageSessions[427**************][threeDSRef]" value="****"> <input id="btnSubmit" type="submit" class="button expanded btn btn-primary" value="Process Payment"> </form>" } |
HTML Page
Code Block |
---|
<!DOCTYPE html> <html> <head> <script> onload = () => document.forms[0].submit(); </script> </head> <body> <form id="form3ds22" method="post" action="https://acs.********"><input type="hidden" name="creq" value="********"> <input type="hidden" name="threeDSPageSessions[427**************][bfreq]" value="*******"> <input type="hidden" name="threeDSPageSessions[427**************][threeDSRef]" value="****"> <input id="btnSubmit" type="submit" class="button expanded btn btn-primary" value="Process Payment"> </form> </body> </html> |
Request for variable schedule
Code Block |
---|
POST https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... User-Agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36", Accept: "*/*" Accept-Encoding: "gzip, deflate, br" Accept-Charset: "" { "payment_type": "variable_schedule", "payment_intent": "pi_rj..........", "customer_name": "Test developer", "customer_email": "test@gmail.com", "reference": "variable schedule payment with 3ds", "customer_address": "Uk....", "customer_postcode": "119083", "currency": "GBP", "paymentToken": "ey............", "device_timezone" : "-330", "device_capabilities" : "javascript", "device_accept_language" : "en-GB", "device_screen_resolution" : "1366x768x24", "remote_address" : "123.123.123.123", "schedule_set": { "13-02-2023": 20.02, "16-02-2023": 22.02, "25-02-2023": 26.02 } } |
Response
Code Block |
---|
HTTP/1.1 201 Created Content-Type: application/json { "id": 123, "payment_type": "variable_schedule", "status": "active", "customer_name": "Test developer", "customer_email": "test@gmail.com, "reference": "variable schedule payment with 3ds", "address": "Uk....", "Postcode": "119083", "currency": "GBP", "start_payment_date": "13-02-2023", "final_payment_date": "25-03-2023", "recurring_amount": 20.02, "is_limited_installments": true, "installments": 12, "frequency": "N/A" "frequency_duration": "N/A" "is_active": true, "recurring_data": { "recurring_id": 1, "payment_date": "13-02-2023", "reference": "Payment 1" "processed_amount": 20.02, "is_processed": true, "status": "accepted", "xref": "AKY........." }, { "recurring_id": 2, "payment_date": "16-03-2023", "reference": "Payment 2" "processed_amount": 22.02, "is_processed": true, "status": "declined", "xref": "AKY........." }, { "recurring_id": 3, "payment_date": "25-03-2023", "reference": "Payment 3" "processed_amount": 26.02, "is_processed": false, "status": "pending", "xref": "AKY........." } } |
Anchor | ||||
---|---|---|---|---|
|
Get all repeat payments
Get the details of all the repeat payment schedules created from the same account.
The results can be filtered by using the below query parameters. payment_type
need to be passed as query param without which the results can't be fetched.
GET /pay/v1/pay/repeat-payments
Headers
Content-Typestring
Content type.
Authorizationstring
Access token generated from create token request.
Query parameters
payment_typestring
Repeat payment type.
fixed_schedule
variable_schedule
pageinteger (optional)
Page Number.
statusstring (optional)
Repeat payment status.
Active - This means the payments have started
Pending - This means the first payment has not yet been processed
Cancelled - This means the schedule has been cancelled. No further payments will be processed
Completed - This means all the payments have been processed. No further payments will be processed
Request
Code Block |
---|
GET https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments?payment_type=variable_schedule&status=active&page=1&payment_type=variable_schedule HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... |
Response
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json { "pageNumber": 1, "pageSize": 50, "totalResults": 7, "data": [ { "id": 8, "payment_type": "variable_schedule", "status": "Active", "customer_name": "customername here", "customer_email": "email@gmail.co.uk", "reference": "Variable schedule test", "address": "2", "postcode": "3", "currency": "GBP", "start_payment_date": "19-02-2024", "final_payment_date": "21-02-2024", "recurring_amount": null, "is_limited_installments": false, "installments": null, "frequency": "N/A", "frequency_duration": "N/A", "is_active": true, "recurring_data": [ { "recurring_id": 190, "payment_date": "2024-02-19", "reference": "Payment 1", "processed_amount": "21.02", "is_processed": true, "status": "Captured", "xref": "AKY........." }, { "recurring_id": 191, "payment_date": "2024-02-20", "reference": "Payment 2", "processed_amount": "1.02", "is_processed": false, "status": "Pending", "xref": "AKY........." }, { "recurring_id": 192, "payment_date": "2024-02-21", "reference": "Payment 3", "processed_amount": "23.02", "is_processed": false, "status": "Pending", "xref": "AKY........." } ] } ] |
Anchor | ||||
---|---|---|---|---|
|
Get repeat payment
Get details of a specific repeat payment schedule using id.
GET /pay/v1/pay/repeat-payments/{id}
Headers
Content-Typestring
Content type.
Authorizationstring
Access token generated from create token request.
Query parameters
payment_typestring
Repeat payment type.
fixed_schedule
variable_schedule
Request
Code Block |
---|
GET https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments/123?payment_type=fixed_schedule HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... |
Response
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json { "id": 123, "payment_type": "fixed_schedule", "status": "active", "customer_name": "Test developer", "customer_email": "test@gmail.com, "reference": "test payment ......", "address": "Uk....", "Postcode": "119083", "Currency": "GBP", "start_payment_date": "23-02-2023", "final_payment_date": "25-03-2023", "recurring_amount": 20.02, "is_limited_installments": true, "installments": 3, "frequency": "days", "frequency_duration": 1, "is_active": true, "recurring_data": { "recurring_id": 1, "payment_date": "2024-02-23", "reference": "Payment 1" "processed_amount": 20.02, "is_processed": true, "status": "captured" "xref": "eygh...." }, { "recurring_id": 2, "payment_date": "2024-02-24", "reference": "Payment 2" "processed_amount": 20.02, "is_processed": false, "status": "pending" "xref": "eygh...." }, { "recurring_id": 3, "payment_date": "2024-02-25", "reference": "Payment 3" "processed_amount": 20.02, "is_processed": false, "status": "removed" "xref": "eygh...." } } |
Anchor | ||||
---|---|---|---|---|
|
Delete a scheduled payment/Cancel all remaining payments
This can be used:
To delete a schedule and all its remaining payments that havent been processed yet, using just the main schedule
id
To delete a specific future payment from a schedule, using the
id
and therecurring_id
The schedule id
and recurring_id
can be fetched from get repeat payment request.
This will delete the future payment from both fixed and variable schedules.
DELETE /pay/v1/repeat-payments/{id}
Headers
Content-Typestring
Content type.
Authorizationstring
Access token generated from create token request.
Attributes
payment_typestring
Repeat payment type. It must be either of the following values. It is passed to identify the type of the specific repeat payment.
fixed_schedule
variable_schedule
recurring_idinteger (optional)
Recurring id is need to be passed to delete a specific recurring event of Fixed and Variable schedule payment.
Request
Code Block |
---|
DELETE https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments/{id} HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... { "payment_type": "fixed_schedule", "recurring_id": 123 } |
Response
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json { "success": true, "message": "Deleted successfully" } |
Anchor | ||||
---|---|---|---|---|
|
Refund a processed payment
Refund any processed repeat payment using repeat schedule id and recurring id.
In this scenario, the id
(repeat schedule id) needs to be passed in the request url, with the recurring_id
and payment_type
in the request body.
This request can be used to refund a processed payment that has a captured
or completed
status
DELETE /pay/v1/repeat-payments/cancel/{id}
Headers
Content-Typestring
Content type.
Authorizationstring
Access token generated from create token request.
Attributes
payment_typestring
Repeat payment type. It must be either of the following values. It is passed to identify the type of the specific repeat payment.
fixed_schedule
variable_schedule
recurring_idinteger
Recurring id needs to be passed to refund a specific payment from a Fixed or Variable schedule.
Request
Code Block |
---|
DELETE https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments/cancel/{id} HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... { "payment_type": "fixed_schedule", "recurring_id": 123 } |
Response
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json { "success": true, "message": "Cancelled successfully" } |
Anchor | ||||
---|---|---|---|---|
|
Retry a processed payment that failed
Retry any specific payment which was able to run on the scheduled day but returned a declined status due to some issue for that Repeat schedule.
This will run the payment for both fixed and variable schedules.
In this scenario, the recurring_id
(fetched from get repeat payment request) needs to be passed in the body, along with the id
(repeat schedule id) in the request url.
POST/pay/v1/repeat-payments/retry/{id}
Headers
Content-Typestring
Content type.
Authorizationstring
Access token generated from create token request.
Attributes
payment_typestring
Repeat payment type. It must be either of the following values. It is passed to identify the type of the specific repeat payment.
fixed_schedule
variable_schedule
recurring_idinteger
Recurring id needs to be passed to retry a specific payment from a Fixed or Variable schedule.
Request
Code Block |
---|
POST https://secure.blinkpayment.co.uk/api/pay/v1/repeat-payments/retry/{id} HTTP/1.1 Content-Type: application/json Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG... { "payment_type": "fixed_schedule", "recurring_id": 123 } |
Response
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json { "success": true, "message": "Payment retried successfully" } |