#valyav-subscriptions
1 messages · Page 1 of 1 (latest)
@compact radish hi! well first of all that's a legacy way of doing things, you shouldn't use default_source. Ideally you would use Checkout to create Subscriptions and not have to do it manually : https://stripe.com/docs/billing/subscriptions/build-subscriptions
but in any case, can you share the request ID req_xxx of that failed attempt so I can see what you're passing exactly?
Create and manage subscriptions to accept recurring payments.
Hi. request id is req_6rn1Sm7l6f9g4c
any reason you can't just use default_payment_method there instead?
but yeah, that is expected, default_source is a legacy parameter and only works with legacy card_xxxx and src_xxx objects, not PaymentMethod pm_xxxx objects.
you'd simply use https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method instead(if you do happen to have legacy card_xxxx and src_xxx objects too, that parameter is seamlessly backwards compatible with them)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
problem with default_payment_method are that our customers could have few cards and some of cards couldn't be as default_payment_method
not sure I understand what you mean, can you elaborate?
we are trying to perform automatic migration of subscription(thats why we cannot use checkouts), we have last4 numbers for card which was used for old subscription:
- we retrieve, using Stripe API, paymentmethods(card) for particular customer;
- chouse from retrieved paymentmethods card with correspond last4 and get it's ID;
- put that paymentmethod ID into request to create subscription, but in responce we've got an error that payment_method is missing.
We cannot use Default payment method, because our customers can have more than 1 card attached to account, and only 1 of that card can be Default payment method.
- put that paymentmethod ID into request to create subscription, but in responce we've got an error that payment_method is missing
that's because you'e using default_source. It would work if you use default_payment_method like I said.
We cannot use Default payment method, because our customers can have more than 1 card attached to account, and only 1 of that card can be Default payment method.
sorry but that makes no sense:
a) default_source is already the same thing, it means "use this one card as the card for any future recurring payments". default_payment_method means exactly the same thing, it's just a new parameter for the current version of the API.
b) yes, of course customers can have multiple cards. You have to pick one of them and make it the default_payment_method(or default_source if you were doing this in a legacy way), since you have to have a card set that will actually get charged for future recurring payments, and that parameter is how you do ut.
Could you tell me please, if there is any way to create subscription using different card for 1 customer? For example, user has 2 cards and we would like to create different subscription using that 2 cards.
do you mean, one customer, with two separate subscriptions?
yes
1 subscription created using first card, second subscription using second card
yep, totally possible then!
you'd call the create Subscription API twice and use a different default_payment_method for each one. https://stripe.com/docs/billing/subscriptions/multiple-products#multiple-subscriptions-for-a-customer
as I understood, customer can have only 1 default payment method, and providing paymentID (in request to create subscription) which is not set as default will return an error
you can have a default payment method per-subscription
that's what you're missing I think.
a Customer can have only one default payment method yes(https://stripe.com/docs/api/customers/create#create_customer-invoice_settings-default_payment_method) , but then on each individual subscription you can set a default (the parameter we've been talking about, https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method) , and when you do that, it takes precedence over the customer-level one for payments made on that subscription.