Links a customer’s payment profile from an external payment gateway (Stripe, Braintree, PayPal, Authorize.Net) to their Shopify customer account. This enables Shopify subscription billing to charge payment methods stored in external gateways, which is essential for migrating existing subscriptions or integrating with legacy payment systems.
What This Endpoint Does: Creates a connection between a Shopify customer and their corresponding customer profile in an external payment gateway. This allows Shopify’s subscription system to send billing requests to the external gateway using the stored payment credentials, effectively enabling subscriptions to bill through payment methods managed outside of Shopify.
Supported Payment Gateways:
1. Stripe (paymentGateway=stripe):
customerProfileId (Stripe customer ID, e.g., cus_xxxxx)paymentProfileId (Stripe payment method ID, e.g., pm_xxxxx or card ID)2. Braintree (paymentGateway=braintree):
customerProfileId (Braintree customer ID)paymentProfileId (Braintree payment method token)3. PayPal (paymentGateway=paypal):
paymentProfileId (PayPal billing agreement ID)customerProfileId (not required for PayPal)4. Authorize.Net (paymentGateway=authorize_net):
customerProfileId (Authorize.Net customer profile ID)paymentProfileId (Authorize.Net payment profile ID)Request Parameters:
Required Parameters:
paymentGateway (string): Gateway name - stripe, braintree, paypal, or authorize_netpaymentProfileId (string): Payment method/card ID in the external gatewaycustomerId OR email (one required): Shopify customer identifierOptional Parameters:
customerProfileId (string): Customer ID in external gateway (required for Stripe, Braintree, Authorize.Net; optional for PayPal)Customer Identification:
By Customer ID (recommended):
customerId if knownBy Email:
email if customer ID unknownUse Cases:
1. Subscription Migration:
2. Payment Gateway Integration:
3. Multi-Platform Sync:
4. Custom Checkout Flows:
Process Flow:
Customer Lookup:
customerId provided: Use directlyemail provided: Search for existing Shopify customerValidation:
Gateway Association:
Response:
Example Requests:
Stripe Example:
GET /api/external/v2/associate-shopify-customer-to-external-payment-gateways?
paymentGateway=stripe&
customerId=12345&
customerProfileId=cus_ABC123&
paymentProfileId=pm_XYZ789
Braintree with Email:
GET /api/external/v2/associate-shopify-customer-to-external-payment-gateways?
paymentGateway=braintree&
email=customer@example.com&
customerProfileId=bt_customer_123&
paymentProfileId=bt_card_token_456
PayPal Example:
GET /api/external/v2/associate-shopify-customer-to-external-payment-gateways?
paymentGateway=paypal&
customerId=12345&
paymentProfileId=B-12345BILLING67890
Important Considerations:
Gateway Setup:
Data Validation:
Customer Creation:
Security:
Best Practices:
customerId over email to avoid ambiguityMigration Workflow Example:
For each legacy subscription:
1. Get customer email and Stripe customer ID from legacy system
2. Call this endpoint to link Shopify customer to Stripe customer
3. Create subscription contract in Shopify using returned payment instrument
4. Verify subscription created successfully
5. Mark legacy subscription as migrated
6. Test billing with external gateway
Troubleshooting:
“More than one customer found for email”:
customerId instead of email“Invalid payment gateway”:
stripe, braintree, paypal, authorize_net“customerProfileId required”:
Response Format: Returns Shopify’s raw GraphQL mutation response containing payment instrument details and success/error information.
Related Endpoints:
GET /api/external/v2/subscription-contract-details/shopify/customer/{customerId}/payment-methods - Verify association successfulPUT /api/external/v2/subscription-contracts-update-payment-method - Use associated payment for subscriptionAuthentication: Requires valid X-API-Key header
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/associate-shopify-customer-to-external-payment-gateways{
"data": {
"customerPaymentMethodRemoteUserInfoCreate": {
"customerPaymentMethod": {
"id": "gid://shopify/CustomerPaymentMethod/abc123",
"instrument": {
"__typename": "CustomerCreditCard",
"brand": "VISA",
"lastDigits": "4242"
}
},
"userErrors": []
}
}
}Documentation Index
Fetch the complete documentation index at: https://appstleinc-aeca3e0a.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Possible values (stripe, braintree, paypal, authorize_net)
Id of the customer to associate payment method with
Email of the customer to associate payment method with
Id of customer in external payment gateway, not required for Paypal
Card Id or payment profile Id in external payment gateway
Successfully associated external payment gateway customer with Shopify customer. Returns Shopify GraphQL raw response.
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/associate-shopify-customer-to-external-payment-gateways{
"data": {
"customerPaymentMethodRemoteUserInfoCreate": {
"customerPaymentMethod": {
"id": "gid://shopify/CustomerPaymentMethod/abc123",
"instrument": {
"__typename": "CustomerCreditCard",
"brand": "VISA",
"lastDigits": "4242"
}
},
"userErrors": []
}
}
}