Skip to main content

Token-Based Subscription Creation

Create subscription

Token-based subscription workflow

Payment and initial charge

For this workflow, you do not need to pay for the order yourself. The flow generates an INITIAL payment, which is paid automatically. To confirm the final payment status, wait for the callback or webhook you receive from Revup.

This flow uses the same endpoint and authentication as Create subscription: POST /subscriptions (for example https://test.api.macropay.com/v2/subscriptions). You add the token-based fields below on top of the usual subscription payload.


Example request

curl --location 'https://test.api.macropay.com/v2/subscriptions' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {X_API_KEY}' \
--data-raw '{
"tokenId": "fc44c6f8-6f92-43ab-98ea-3302b7586e7c",
"parentTransactionId": "eebebc0b-dd2f-44c4-a8a8-743ff731a4a1",
"parentOrderId": "80105327-c24a-4e52-9648-08f85f89061f",
"planId": "4aa7c1e4-cf8c-4d1c-a6ad-451dd07411ee",
"currency": "EUR",
"eventSubscriptionUrl": "https://2ec7-54-73-197-22.ngrok-free.app/events",
"redirectUrl": {
"success": "https://2ec7-54-73-197-22.ngrok-free.app/success?text=123456",
"fail": "https://2ec7-54-73-197-22.ngrok-free.app/failed"
},
"userInformation": {
"ip": "62.57.181.213",
"email": "testing.subscriptions@macropay.com",
"country": "ES",
"language": "ES"
},
"overwrite": {
"initialAmount": 111.99
},
"concept": "subscription with token concept",
"description": "subscription with token description",
"domain": "https://www.merchant.com",
"customTag": "Test"
}'

Compared with a subscription-first order, token-based creation adds three required fields when you use a tokenized card. Several other fields are not required for this workflow (see below).


Specific token-based fields

NAMEDESCRIPTIONREQUIRED
tokenIdToken ID generated by the CORE order payment with generateToken: trueYes, if you set up a subscription using a tokenized card
parentTransactionIdTransaction ID generated by the CORE order payment with generateToken: trueYes, if you set up a subscription using a tokenized card
parentOrderIdOrder ID generated by the CORE order payment with generateToken: trueYes, if you set up a subscription using a tokenized card

Fields not needed in this workflow

NAMEDESCRIPTIONREQUIRED
redirectUrl.threeDSChallengeResultToken-based payment does not require 3DSNo
threeDSSupportToken-based payment does not require 3DSNo
paymentDetailsPayment type is already known from the token flowNo

Example response

{
"orderId": "80105327-c24a-4e52-9648-08f85f89061f",
"subscriptionId": "0192b445-55a7-74af-a5d1-79ca6d2310f4"
}
NAMEDESCRIPTION
orderIdThe same orderId you sent as parentOrderId. The original response contract is preserved.
subscriptionIdThe subscription identifier created by this flow.

Known restrictions

One subscription per token

At this time, you can only create one subscription per tokenId.

First payment attempt

After the order is created, the system attempts payment using the provided token. The first token-based payment attempt cannot be retried by our system. Once the subscription is successfully created and paid, subsequent retries for recurring charges are handled by Revup as usual.