Preparing Subscriptions using Digital Wallet Data
You can set up a subscription billing relationship with the NMI gateway, even if the customer wants to pay with Apple Pay or Google Pay. Simply provide the customer’s payment information, and a schedule, and the gateway automatically fires off the transactions on a negotiated timeline.
1. Prepare To Accept Apple Pay
Make sure you’re already configured to accept Apple Pay and/or Google Pay. For Apple Pay, be sure that the appropriate domains and verification files are set up in the Merchant Portal under Settings > Apple Pay.

If you’re setting up Apple or Google Pay for the first time, you might want to try a test “one-time” transaction first to make sure that you’re ready to process digital wallet transactions.
2. Collect Digital Wallet Data
Your shopping cart now needs to collect the Apple Pay/Google Pay data.
If your cart gathers Apple Pay or Google Pay data directly, your server should already be set up to receive the encrypted wallet data during the checkout flow.
If you use Collect.js, you can choose to surface a ready-made “Pay with Apple Pay” or “Pay with Google Pay” button. When the customer interaction completes, it will post data to your server including a payment_token
linked to the encrypted wallet data. See the Digital Wallet Setup guide for more details and example code.
3. Submit The Subscription Request
Your server can now submit a request to the Gateway to board the vault data. Please see the following examples for using either a Collect.JS payment_token or raw wallet data. These represent a subscription for $30 per month, billed on the 15th of each month, for the next twelve months, starting on July 15, 2025.
Collect.JS Based Subscription
curl --request POST \
--url https://secure.nmi.com/api/transact.php \
--header 'accept: application/x-www-form-urlencoded' \
--header 'content-type: application/x-www-form-urlencoded'
--data recurring=add_subscription \
--data plan_payments=12 \
--data plan_amount=30.00 \
--data month_frequency=1 \
--data day_of_month=15 \
--data start_date=20250715 \
--data payment_token=00000000-000000-000000-000000000000\
--data first_name=John \
--data last_name=Doe \
--data 'address1=123 Main Street' \
--data 'address2=Apt E' \
--data city=Wichita \
--data state=KS \
--data zip=12345 \
--data country=US \
--data phone=8005551212 \
--data [email protected] \
--data security_key=XXXXXXXXXXXXXXXXXXXXXXXX
Encrypted Wallet Data Based Subscription
(for Google Pay, send googlepay_payment_data
instead)
curl --request POST \
--url https://secure.nmi.com/api/transact.php \
--header 'accept: application/x-www-form-urlencoded' \
--header 'content-type: application/x-www-form-urlencoded'
--data recurring=add_subscription \
--data plan_payments=12 \
--data plan_amount=30.00 \
--data month_frequency=1 \
--data day_of_month=15 \
--data start_date=20250715 \
--data applepay_payment_data=EEvIz56vkjN….zb5MD45fh7687SGfTd=
--data first_name=John \
--data last_name=Doe \
--data 'address1=123 Main Street' \
--data 'address2=Apt E' \
--data city=Wichita \
--data state=KS \
--data zip=12345 \
--data country=US \
--data phone=8005551212 \
--data [email protected] \
--data security_key=XXXXXXXXXXXXXXXXXXXXXXXX
Decrypted Wallet Data
(for Google Pay, send decrypted_googlepay_data
instead)
curl --request POST \
--url https://secure.nmi.com/api/transact.php \
--header 'accept: application/x-www-form-urlencoded' \
--header 'content-type: application/x-www-form-urlencoded'
--data recurring=add_subscription \
--data plan_payments=12 \
--data plan_amount=30.00 \
--data month_frequency=1 \
--data day_of_month=15 \
--data start_date=20250715 \
--data ccnumber=4111111111111111 \
--data ccexp=1234 \
--data cavv=MTIzNDU2Nzg5MDEyMzQ1Njc4OTA= \
--data decrypted_applepay_data=1 \
--data first_name=John \
--data last_name=Doe \
--data 'address1=123 Main Street' \
--data 'address2=Apt E' \
--data city=Wichita \
--data state=KS \
--data zip=12345 \
--data country=US \
--data phone=8005551212 \
--data [email protected] \
--data security_key=XXXXXXXXXXXXXXXXXXXXXXXX
4. Real Time Transaction
When the subscription is registered, we perform a transaction in real time. For Google Pay, this is a $0 authorization. For Apple Pay, the transaction is based on the amount baked into the Apple Pay wallet data. (If you use Collect.js to build a subscription request, it defaults to $0). This transaction ensures that we consume the perishable "cryptogram" part of the wallet data before it expires, so the next transaction-- which won't take place until the start_date
can run smoothly. Performing a transaction in real time also allows us to block the subscription immediately if the payment data is bad, rather than waiting for the first subscription payment to fail.
5. Subscription Lifecycle
Once a subscription is set up, the request sits idle until start_date
occurs. We then automatically trigger a sale for the subscription’s amount
.
Each payment request is automatically tagged as merchant-initiated and recurring, and linked to the transaction performed when the subscription was initially requested. The process continues on the given schedule until the subscription expires, is deactivated, or is paused due to a payment failure.
Updated about 1 hour ago