I have a Shopify Website that uses Recharge as a subscription manager.
I want to switch from Recharge to Shopify Subscriptions, their new app.
To do so, I can import in Shopify Subscription app a .csv file.
This csv file requiers some fields such as handle, upcoming_billing_date, customer_id, …, customer_payment_method_id).
// See : https://help.shopify.com/en/manual/products/purchase-options/shopify-subscriptions/import-export/importing-and-exporting
So I get from the Recharge API all this info and formatted a .csv file with these fields !
BUT… IN SOME CASES… ONE FIELD INFO IS MISSING !
For some clients, I get a good customer_payment_method_id (The ID for the payment method used by the customer for the contract. The ID is unique alphanumeric code. For example, 24e8c839c47ef47d30ad28346d130e74).
For some others, as Recharge also uses Stripe, I find a customer_payment_method_id but it looks like Stripe syntaxe : pm_1PRfaqCDgYAbXXXXXXXX. And this can’t be imported.
My questions :
Does someone knows where I can find a customer_payment_method_id in the case a user went through Recharge and Stripe that matches Shopify alphanumeric code format ?
Or event, is it even possible to import clients with Stripe id into Shopify and how ?
I tried 3 things :
1- I requested the Recharge API to get the user’s info from one that used Stripe through Recharge. No customer_payment_method_id. (https://api.rechargeapps.com/customers?email=…)
2- I requested the Recharge API to get the user’s payment_methods and compared from a user I can import see first object, and a user I can’t import :
CAN BE IMPORTED USER :
“payment_methods”: [
{
“id”: 7507XXXX,
“customer_id”: 994XXXX,
“billing_address”: {
“address1”: “”,
“city”: “”,
“country”: “”,
“first_name”: “”,
“last_name”: “”,
“phone”: “”,
“zip”: “”
},
“created_at”: “2022-11-XX”,
“payment_details”: {
“brand”: “visa”,
“exp_month”: ,
“exp_year”: ,
“last4”: “”
},
“payment_type”: “CREDIT_CARD”,
“processor_customer_token”: “616135XXXXX”,
“processor_name”: “shopify_payments”,
** “processor_payment_method_token”: “gid://shopify/CustomerPaymentMethod/3c0a6863dd377b4d3bXXXXXXX”,**
“status”: “valid”,
“updated_at”: “2024-05-XX”
}
]
Here I find my customer_payment_method_id as the digits at the end of “processor_payment_method_token”: “gid://shopify/CustomerPaymentMethod/3c0a6863dd377b4d3bXXXXXXX“
CANNOT BE IMPORTED USER :
“payment_methods”: [
{
“id”: 1395XXX,
“customer_id”: 152XXX,
“billing_address”: {
“address1”: “”,
“city”: “”,
“country”: “”,
“first_name”: “”,
“last_name”: “”,
“phone”: “”,
“zip”: “”
},
“created_at”: “2024-06-XX”,
“payment_details”: {
“brand”: “mastercard”,
“exp_month”: ,
“exp_year”: ,
“last4”: “”
},
“payment_type”: “CREDIT_CARD”,
** “processor_customer_token”: “cus_QIG7PJjtXXXX”,
“processor_name”: “stripe”,
“processor_payment_method_token”: “pm_1PRfaqCDgYAbUXXXXX”,**
“status”: “valid”,
“updated_at”: “2024-06-XX”
}
]
}
Here the customer_payment_method_id doesn’t match the requirement for import, its a pm_1PRfaqCDgYAbUXXXXX and we see it comes from Stripe, “processor_name”: “stripe”.
3- Finally, I tried to add a subscription contract to my user that can’t be imported with a Mutation to set it from scratch, so I used the Shopify API.
// See https://shopify.dev/docs/apps/build/purchase-options/subscriptions/migrate-to-subscriptions-api/migrate-subscription-contracts
BUT even in the GraphQL query, they ask for the paymentMethodId :
mutation subscriptionContractAtomicCreate {
subscriptionContractAtomicCreate(input: {
customerId: “gid://shopify/Customer/1”,
nextBillingDate: “2024-06-01”,
currencyCode: USD,
contract: {
status: ACTIVE,
paymentMethodId: “gid://shopify/CustomerPaymentMethod/869e7a39”,
billingPolicy: {
interval: MONTH,
intervalCount: 1,
minCycles: 3
},
And I still don’t have it… 🙂
user25978975 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.