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-Type string
Content type.
Authorization string
Access token generated from create token request.
Attributes - (Required for all schedules)
payment_type string
Repeat payment type. It must be either of the following values.
fixed_schedule
variable_schedule
payment_intent string
Payment intent generated from create intent request.
paymentToken string
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_name string
Customer name.
customer_email string
Customer email.
reference string
Reference value. Unique textual details of the schedule
customer_address string
Customer address.
customer_postcode string
Customer postcode.
currency string
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)
frequency string
Payment cycle frequency. It is required when creating a Fixed Schedule.
Possible values are
days
weeks
months
frequency_duration integer
Payment frequency duration. It is required when creating a Fixed Schedule.
(E.g. “2” and “days” will be every 2 days)
start_payment_date date
Date on which the first payment will be captured.
It is required when creating a Fixed Schedule.
Default value set to today.
first_amount decimal (optional)
First payment amount.
When creating a Fixed Schedule, the first amount value can be customised.
recurring_amount decimal
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
installments integer
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_amount decimal (optional) final_payment_date date (optional) |
Specific fields for a Variable schedule - (This cannot be used in conjunction with any of the above Fixed schedule specific fields)
schedule_set array
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
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
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
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
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........." } }
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-Type string
Content type.
Authorization string
Access token generated from create token request.
User-Agent string
User agent.
Accept string
Accept
Accept-Encoding string
Accept encoding.
Accept-Charset string
Accept charset.
Attributes - (required for all schedules)
payment_type string
Repeat payment type. It must be either of the following values.
fixed_schedule
variable_schedule
payment_intent string
Payment intent generated from create intent request.
paymentToken string
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_name string
Customer name.
customer_email string
Customer email.
reference string
Reference value. Unique textual details of the schedule
customer_address string
Customer address.
customer_postcode string
Customer postcode.
currency string
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)
frequency string
Payment cycle frequency. It is required when creating a Fixed Schedule.
Possible values are
days
weeks
months
frequency_duration integer
Payment frequency duration. It is required when creating a Fixed Schedule.
(E.g. “2” and “days” will be every 2 days)
start_payment_date date
Date on which the first payment will be captured.
It is required when creating a Fixed Schedule.
Default value set to today.
first_amount decimal (optional)
First payment amount.
When creating a Fixed Schedule, the first amount value can be customised.
recurring_amount decimal
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
installments integer
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_amount decimal (optional) final_payment_date date (optional) |
Specific fields for a Variable schedule - (This cannot be used in conjunction with any of the above Fixed schedule specific fields)
schedule_set array
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_timezone integer
Device timezone value which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
device_capabilities string
Device capabilities which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
device_accept_language string
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_resolution string
Device accept language which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.
remote_address string
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
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
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
<!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
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
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........." } }
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-Type string
Content type.
Authorization string
Access token generated from create token request.
Query parameters
payment_type string
Repeat payment type.
fixed_schedule
variable_schedule
page integer (optional)
Page Number.
status string (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
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
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........." } ] } ]
Get repeat payment
Get details of a specific repeat payment schedule using id.
GET /pay/v1/pay/repeat-payments/{id}
Headers
Content-Type string
Content type.
Authorization string
Access token generated from create token request.
Query parameters
payment_type string
Repeat payment type.
fixed_schedule
variable_schedule
Request
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
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...." } }
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-Type string
Content type.
Authorization string
Access token generated from create token request.
Attributes
payment_type string
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_id integer (optional)
Recurring id is need to be passed to delete a specific recurring event of Fixed and Variable schedule payment.
Request
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
HTTP/1.1 200 OK Content-Type: application/json { "success": true, "message": "Deleted successfully" }
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-Type string
Content type.
Authorization string
Access token generated from create token request.
Attributes
payment_type string
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_id integer
Recurring id needs to be passed to refund a specific payment from a Fixed or Variable schedule.
Request
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
HTTP/1.1 200 OK Content-Type: application/json { "success": true, "message": "Cancelled successfully" }
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-Type string
Content type.
Authorization string
Access token generated from create token request.
Attributes
payment_type string
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_id integer
Recurring id needs to be passed to retry a specific payment from a Fixed or Variable schedule.
Request
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
HTTP/1.1 200 OK Content-Type: application/json { "success": true, "message": "Payment retried successfully" }