Process payments with Ryft: authorizations, voids, captures, refunds etc.
- Retrieve a list of the payments specific to a subscription
Ryft Payment API (1.1.0)
Ryft provides a collection of APIs that you can use to accept and process payments + marketplace functionality (payouts). We have a testing environment called sandbox, which you can sign up for to test API calls without affecting live data.
When you sign up for an account, you are given a secret and public API key pair. You authenticate with our API by providing the appropriate key in the request Authorization header. Never share your secret keys. Keep them guarded and secure.
Public keys should only be used in JavaScript or native applications. This key is solely used to identify the partner making requests. Supply this key in the Authorization header.
Your secret key should always be supplied in the Authorization header. Make sure this key is stored securely on your backend and never surfaced client-side.
We use rate limiting on a per-user basis to protect our APIs against abuse. Our Sandbox environment is limited to 5 requests per second. Our production environment is limited to 50 requests per second.
We also allow a brief burst above this limit to accommodate a sudden increase in traffic.
If you exceed the above quota then the API will respond with a 429 status code and you will need to retry the API call (we recommend implementing a retry policy with an exponential back-off).
Events
Events are persisted throughout the lifecycle of a payment/action as you use our API. We use events to notify you when something important happens in your account (or a linked sub account). The most commonly used event occurs when a payment is captured, in which case we persist a PaymentSession.captured event and then (optionally) send it to any webhooks you have registered that are listening for that event type.
Note that if you are taking payments as a platform (for sub accounts), events are saved against the sub account accountId, but will be sent to any webhooks that your account has configured.
Payouts
A payout represents the transfer of money from Ryft to a connected payout method (bank account), i.e. when we send money you're owed. Typically this is automated.
However, the payouts API allows you to explicitly create payouts for your sub accounts. Generally we'd recommend this if you are a marketplace who wants to control exactly when payouts should be sent out.
Transfers
A Transfer represents the movement of money between Ryft accounts.
This API allows platforms/marketplaces to transfer money from/to particular sub accounts, useful when:
- you owe a sub account money from a particular transaction and want to explicitly send it after the fact
- you want to recoup funds from a sub account, such as when dealing with disputes
- you want to collect additional/new commission from the sub account
Subscriptions
The subscriptions API allows you to automatically have Ryft schedule and charge recurring payments for a specific day and time. This API is not required to process recurring payments. After additional configuration, you can use our payment-sessions API to create and charge the recurring payments yourself.
The customer the subscription is for
Defines how much and how often to charge the customer for the subscription
Use if you want to select an already stored card on file for the subscription and skip collecting new payment details from your customer. Must belong to the customerId provided in this request. Note that 3DS will be required on the initial payment.
(optional) description that helps you personalise/identify the specific subscription
The (epoch) timestamp representing the date on which the customer will regularly be billed. e.g. 15th of each month. Defaults to today if not provided.
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions
- Production environmenthttps://api.ryftpay.com/v1/subscriptions
- cURL
- Node
- Python
curl -i -X POST \
https://sandbox-api.ryftpay.com/v1/subscriptions \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"customer": {
"id": "cus_01G0EYVFR02KBBVE2YWQ8AKMGJ"
},
"price": {
"amount": 5000,
"currency": "GBP",
"interval": {
"unit": "Months",
"count": 1,
"times": 12
}
},
"paymentMethod": {
"id": "pmt_01FCTS1XMKH9FF43CAFA4CXT3P"
},
"description": "Bob'\''s monthly gym membership",
"billingCycleTimestamp": 1631703901,
"metadata": {
"orderId": "1",
"customerId": "123"
},
"shippingDetails": {
"address": {
"firstName": "Fox",
"lastName": "Mulder",
"lineOne": "Stonehenge",
"postalCode": "SP4 7DE",
"city": "Salisbury",
"country": "GB"
}
},
"paymentSettings": {
"statementDescriptor": {
"descriptor": "Ryft Ltd",
"city": "London"
}
}
}'The subscription was created successfully
The ID of the subscription
(optional) description helps you personalise/identify the specific subscription
The full outstanding amount owed by the customer for this subscription. Any outstanding amount will be included in future cycle payments (on top of the recurring price)
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
Settings for controlling fields/options on the underlying Payment Session's created by this subscription.
{ "id": "sub_01G0EYVFR02KBBVE2YWQ8AKMGJ", "status": "Active", "description": "Bob's monthly gym membership", "customer": { "id": "cus_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentMethod": { "id": "pmt_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentSessions": { "initial": { … }, "latest": { … } }, "price": { "amount": 5000, "currency": "GBP", "interval": { … } }, "balance": { "amount": 5000 }, "pausePaymentDetail": { "reason": "Offering service for free to customer", "resumeAtTimestamp": 1470989538, "pausedAtTimestamp": 1470989538 }, "cancelDetail": { "reason": "Customer no longer wants to use the service", "cancelledAtTimestamp": 1480989538 }, "billingDetail": { "totalCycles": 12, "currentCycle": 4, "currentCycleStartTimestamp": 1480989538, "currentCycleEndTimestamp": 1480989538, "billingCycleTimestamp": 1480989538, "nextBillingTimestamp": 1480989538, "failureDetail": { … } }, "shippingDetails": { "address": { … } }, "metadata": { "myCustomerId": "1" }, "paymentSettings": { "statementDescriptor": { … } }, "createdTimestamp": 1470989538 }
The start timestamp (inclusive), it must be before the endTimestamp. If not provided will default to midnight on the current date (UTC).
The timestamp when to return payment sessions up to (inclusive), it must be after the startTimestamp. If not provided it will default to the current time (UTC).
Control the order (newest or oldest) in which the subscriptions are returned. false will arrange the results with newest first, whereas true shows oldest first. The default is false.
Control how many items are return in a given page The max limit we allow is 25. The default is 10.
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions
- Production environmenthttps://api.ryftpay.com/v1/subscriptions
- cURL
- Node
- Python
curl -i -X GET \
https://sandbox-api.ryftpay.com/v1/subscriptions \
-H 'Authorization: YOUR_API_KEY_HERE'{ "items": [ { … } ], "paginationToken": "sub_01FCTS1XMKH9FF43CAFA4CXT3P_1641912473" }
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions/{subscriptionId}
- Production environmenthttps://api.ryftpay.com/v1/subscriptions/{subscriptionId}
- cURL
- Node
- Python
curl -i -X GET \
https://sandbox-api.ryftpay.com/v1/subscriptions/sub_01FCTS1XMKH9FF43CAFA4CXT3P \
-H 'Authorization: YOUR_API_KEY_HERE'Successfully retrieved the given Subscription
The ID of the subscription
(optional) description helps you personalise/identify the specific subscription
The full outstanding amount owed by the customer for this subscription. Any outstanding amount will be included in future cycle payments (on top of the recurring price)
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
Settings for controlling fields/options on the underlying Payment Session's created by this subscription.
{ "id": "sub_01G0EYVFR02KBBVE2YWQ8AKMGJ", "status": "Active", "description": "Bob's monthly gym membership", "customer": { "id": "cus_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentMethod": { "id": "pmt_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentSessions": { "initial": { … }, "latest": { … } }, "price": { "amount": 5000, "currency": "GBP", "interval": { … } }, "balance": { "amount": 5000 }, "pausePaymentDetail": { "reason": "Offering service for free to customer", "resumeAtTimestamp": 1470989538, "pausedAtTimestamp": 1470989538 }, "cancelDetail": { "reason": "Customer no longer wants to use the service", "cancelledAtTimestamp": 1480989538 }, "billingDetail": { "totalCycles": 12, "currentCycle": 4, "currentCycleStartTimestamp": 1480989538, "currentCycleEndTimestamp": 1480989538, "billingCycleTimestamp": 1480989538, "nextBillingTimestamp": 1480989538, "failureDetail": { … } }, "shippingDetails": { "address": { … } }, "metadata": { "myCustomerId": "1" }, "paymentSettings": { "statementDescriptor": { … } }, "createdTimestamp": 1470989538 }
Defines how much and how often to charge the customer for the Subscription. At least one field should be specified. You can change just the amount OR the interval OR both. Note that merchants operating in the European Union must notify the customer 4 weeks in advance of any changes in pricing. You cannot update this field if the Subscription is Paused, PastDue, Cancelled or Ended. Any updates to the price will be reflected instantly but will only take effect in the next billing cycle
Update the payment method that will be charged throughout the subscription. This is useful if your customer wishes to change their card or if a previous card has expired. Note that changing this field will trigger the next payment to apply 3DS - check the requiredAction on the latest payment session. Changing this field whilst in PastDue will trigger a automatic retry at the next available opportunity - check the NextBillingTimestamp
(optional) description that helps you personalise/identify the specific subscription
The (epoch) timestamp representing the date on which the customer will regularly be billed. e.g. 15th of each month. You can only update this field if the Subscription is Pending. If you update this field to today then a payment will be triggered immediately. Note: If you want to update this for an Active subscription then we recommend cancelling and re-creating the subscription.
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions/{subscriptionId}
- Production environmenthttps://api.ryftpay.com/v1/subscriptions/{subscriptionId}
- cURL
- Node
- Python
curl -i -X PATCH \
https://sandbox-api.ryftpay.com/v1/subscriptions/sub_01FCTS1XMKH9FF43CAFA4CXT3P \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"price": {
"amount": 5000,
"interval": {
"unit": "Months",
"count": 1,
"times": 12
}
},
"paymentMethod": {
"id": "pmt_01FCTS1XMKH9FF43CAFA4CXT3P"
},
"description": "Bob'\''s monthly gym membership",
"billingCycleTimestamp": 1631703901,
"metadata": {
"orderId": "1",
"customerId": "123"
},
"shippingDetails": {
"address": {
"firstName": "Fox",
"lastName": "Mulder",
"lineOne": "Stonehenge",
"postalCode": "SP4 7DE",
"city": "Salisbury",
"country": "GB"
}
},
"paymentSettings": {
"statementDescriptor": {
"descriptor": "Ryft Ltd",
"city": "London"
}
}
}'The subscription was updated successfully
The ID of the subscription
(optional) description helps you personalise/identify the specific subscription
The full outstanding amount owed by the customer for this subscription. Any outstanding amount will be included in future cycle payments (on top of the recurring price)
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
Settings for controlling fields/options on the underlying Payment Session's created by this subscription.
{ "id": "sub_01G0EYVFR02KBBVE2YWQ8AKMGJ", "status": "Active", "description": "Bob's monthly gym membership", "customer": { "id": "cus_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentMethod": { "id": "pmt_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentSessions": { "initial": { … }, "latest": { … } }, "price": { "amount": 5000, "currency": "GBP", "interval": { … } }, "balance": { "amount": 5000 }, "pausePaymentDetail": { "reason": "Offering service for free to customer", "resumeAtTimestamp": 1470989538, "pausedAtTimestamp": 1470989538 }, "cancelDetail": { "reason": "Customer no longer wants to use the service", "cancelledAtTimestamp": 1480989538 }, "billingDetail": { "totalCycles": 12, "currentCycle": 4, "currentCycleStartTimestamp": 1480989538, "currentCycleEndTimestamp": 1480989538, "billingCycleTimestamp": 1480989538, "nextBillingTimestamp": 1480989538, "failureDetail": { … } }, "shippingDetails": { "address": { … } }, "metadata": { "myCustomerId": "1" }, "paymentSettings": { "statementDescriptor": { … } }, "createdTimestamp": 1470989538 }
Request
Used to schedule a pause for a Subscription. Only 'Active' subscriptions can be paused, though the details for already 'Paused' subscriptions can also be edited. The subscription will remain in 'Active' and will be moved to 'Paused' when it was next due to be billed. The reason or duration of the pause can be edited by calling this endpoint again, even after it has moved to 'Paused'. After a pause is scheduled but whilst still in 'Active', the pause can be unscheduled via the 'unschedule' flag.
Optional field describing why the subscription is being paused.
The epoch timestamp (seconds) when the subscription should resume collecting payments. If not specified, the subscription will remain paused indefinitely until a /resume API call is made.
A flag used to unschedule an already scheduled pause, resulting in the customer being billed as normal (as they were before). This can only be 'true' if the subscription is still 'Active', a pause has been scheduled and no other fields are provided. To resume an already 'Paused' subscription then either update the 'resumeAtTimestamp' or call /resume.
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions/{subscriptionId}/pause
- Production environmenthttps://api.ryftpay.com/v1/subscriptions/{subscriptionId}/pause
- cURL
- Node
- Python
curl -i -X PATCH \
https://sandbox-api.ryftpay.com/v1/subscriptions/sub_01FCTS1XMKH9FF43CAFA4CXT3P/pause \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"reason": "Offering service for free to customer",
"resumeAtTimestamp": 1470989538,
"unschedule": false
}'The subscription was paused successfully
The ID of the subscription
(optional) description helps you personalise/identify the specific subscription
The full outstanding amount owed by the customer for this subscription. Any outstanding amount will be included in future cycle payments (on top of the recurring price)
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
Settings for controlling fields/options on the underlying Payment Session's created by this subscription.
{ "id": "sub_01G0EYVFR02KBBVE2YWQ8AKMGJ", "status": "Active", "description": "Bob's monthly gym membership", "customer": { "id": "cus_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentMethod": { "id": "pmt_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentSessions": { "initial": { … }, "latest": { … } }, "price": { "amount": 5000, "currency": "GBP", "interval": { … } }, "balance": { "amount": 5000 }, "pausePaymentDetail": { "reason": "Offering service for free to customer", "resumeAtTimestamp": 1470989538, "pausedAtTimestamp": 1470989538 }, "cancelDetail": { "reason": "Customer no longer wants to use the service", "cancelledAtTimestamp": 1480989538 }, "billingDetail": { "totalCycles": 12, "currentCycle": 4, "currentCycleStartTimestamp": 1480989538, "currentCycleEndTimestamp": 1480989538, "billingCycleTimestamp": 1480989538, "nextBillingTimestamp": 1480989538, "failureDetail": { … } }, "shippingDetails": { "address": { … } }, "metadata": { "myCustomerId": "1" }, "paymentSettings": { "statementDescriptor": { … } }, "createdTimestamp": 1470989538 }
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions/{subscriptionId}/resume
- Production environmenthttps://api.ryftpay.com/v1/subscriptions/{subscriptionId}/resume
- cURL
- Node
- Python
curl -i -X PATCH \
https://sandbox-api.ryftpay.com/v1/subscriptions/sub_01FCTS1XMKH9FF43CAFA4CXT3P/resume \
-H 'Authorization: YOUR_API_KEY_HERE'The subscription was resumed successfully
The ID of the subscription
(optional) description helps you personalise/identify the specific subscription
The full outstanding amount owed by the customer for this subscription. Any outstanding amount will be included in future cycle payments (on top of the recurring price)
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
Settings for controlling fields/options on the underlying Payment Session's created by this subscription.
{ "id": "sub_01G0EYVFR02KBBVE2YWQ8AKMGJ", "status": "Active", "description": "Bob's monthly gym membership", "customer": { "id": "cus_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentMethod": { "id": "pmt_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentSessions": { "initial": { … }, "latest": { … } }, "price": { "amount": 5000, "currency": "GBP", "interval": { … } }, "balance": { "amount": 5000 }, "pausePaymentDetail": { "reason": "Offering service for free to customer", "resumeAtTimestamp": 1470989538, "pausedAtTimestamp": 1470989538 }, "cancelDetail": { "reason": "Customer no longer wants to use the service", "cancelledAtTimestamp": 1480989538 }, "billingDetail": { "totalCycles": 12, "currentCycle": 4, "currentCycleStartTimestamp": 1480989538, "currentCycleEndTimestamp": 1480989538, "billingCycleTimestamp": 1480989538, "nextBillingTimestamp": 1480989538, "failureDetail": { … } }, "shippingDetails": { "address": { … } }, "metadata": { "myCustomerId": "1" }, "paymentSettings": { "statementDescriptor": { … } }, "createdTimestamp": 1470989538 }
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions/{subscriptionId}/cancel
- Production environmenthttps://api.ryftpay.com/v1/subscriptions/{subscriptionId}/cancel
- cURL
- Node
- Python
curl -i -X DELETE \
https://sandbox-api.ryftpay.com/v1/subscriptions/sub_01FCTS1XMKH9FF43CAFA4CXT3P/cancel \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"reason": "Customer no longer wants service"
}'Successfully cancelled the given Subscription
The ID of the subscription
(optional) description helps you personalise/identify the specific subscription
The full outstanding amount owed by the customer for this subscription. Any outstanding amount will be included in future cycle payments (on top of the recurring price)
use this parameter to attach key-value data to the subscription. These will be sent with any subscription events to your webhooks. You can have a maximum of 5 pieces of metadata.
Settings for controlling fields/options on the underlying Payment Session's created by this subscription.
{ "id": "sub_01G0EYVFR02KBBVE2YWQ8AKMGJ", "status": "Active", "description": "Bob's monthly gym membership", "customer": { "id": "cus_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentMethod": { "id": "pmt_01G0EYVFR02KBBVE2YWQ8AKMGJ" }, "paymentSessions": { "initial": { … }, "latest": { … } }, "price": { "amount": 5000, "currency": "GBP", "interval": { … } }, "balance": { "amount": 5000 }, "pausePaymentDetail": { "reason": "Offering service for free to customer", "resumeAtTimestamp": 1470989538, "pausedAtTimestamp": 1470989538 }, "cancelDetail": { "reason": "Customer no longer wants to use the service", "cancelledAtTimestamp": 1480989538 }, "billingDetail": { "totalCycles": 12, "currentCycle": 4, "currentCycleStartTimestamp": 1480989538, "currentCycleEndTimestamp": 1480989538, "billingCycleTimestamp": 1480989538, "nextBillingTimestamp": 1480989538, "failureDetail": { … } }, "shippingDetails": { "address": { … } }, "metadata": { "myCustomerId": "1" }, "paymentSettings": { "statementDescriptor": { … } }, "createdTimestamp": 1470989538 }
The timestamp when to return payment sessions from (inclusive), it must be before the endTimestamp. If not provided it will default to 0
The timestamp when to return payment sessions up to (inclusive), it must be after the startTimestamp. If not provided it will default to the current time (UTC).
Control the order (newest or oldest) in which the payment sessions are returned. false will arrange the results with newest first, whereas true shows oldest first. The default is false.
Control how many items are return in a given page The max limit we allow is 25. The default is 10.
- Sandbox environmmenthttps://sandbox-api.ryftpay.com/v1/subscriptions/{subscriptionId}/payment-sessions
- Production environmenthttps://api.ryftpay.com/v1/subscriptions/{subscriptionId}/payment-sessions
- cURL
- Node
- Python
curl -i -X GET \
https://sandbox-api.ryftpay.com/v1/subscriptions/sub_01FCTS1XMKH9FF43CAFA4CXT3P/payment-sessions \
-H 'Authorization: YOUR_API_KEY_HERE'{ "items": [ { … } ], "paginationToken": "ps_01FCTS1XMKH9FF43CAFA4CXT3P" }