#arthuryueh
1 messages · Page 1 of 1 (latest)
Probably you didn't have any card Payment Methods? Have you checked on your requests log in Stripe Dashboard?
Sorry I was trying PayNow
curl -G https://api.stripe.com/v1/payment_methods
-u sk_test_xxxxxxx:
-d type=paynow
I'm using the test key from SG account, the paynow method was also turned on in the Setting.
I don't have transactions
Need transactions to get a payment method id ? I thought it was a payment method list query, and it will return id, that's all.
No it will returns all PaymentMethod was actually used in a transaction. The results would be like pm_xxx, pm_yyy .... and the Payment Method objects
See example response here: https://stripe.com/docs/api/payment_methods/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But The doucment said
Returns a list of PaymentMethods attached to the StripeAccount. For listing a customer’s payment methods, you should use List a Customer’s PaymentMethods
I just need the payment methods that available for the StripeAccount, and then attach it to a stirpe customer.
Sorry if the wording is confusing, but it means the payment methods has actually been used.
Sorry could you explain to me what's the meaning of attaching payment method to a stripe customer ?
I'm currently trying to follow a old process to implement paynow integration. And in the process it will attach a payment method to a stripe customer before create payment intent.
So I think there is no transactions before the customer pays right?
If need transactions to get payment method id, then I don't know how the old process get the payment method id first.
Thank you
Sure, do you have a specific doc that you are following?
If it says to attach a payment method to a stripe customer, then you need to somehow collect that payment method beforehand, which is the missing piece here
Sorry only got codes.... 🙏
Okie, so you should think "a payment method" is an object, has an ID of pm_xxx and various properties inside. You don't suddenly have that object, you need to collect it beforehand using client-side somehow
Eventually it sounds like a legacy integration to me. You should really follow our latest guide: https://stripe.com/docs/payments/paynow/accept-a-payment?platform=web#create-payment-intent on creating a PaymentIntent first, then confirm it client-side. And by confirming you will collect PaymentMethod at the same time
ok I'll do more research about the process and this document, thank you 🙏
The PaymentMethod and the customer will be bounded (sorry sounds obvious but that's really what it means)
Sorry one last question, what will happen if we attach a payment method to a stripe customer ?
Will it show some informations on the stripe customer page ?
If we have created a stripe customer, and when creating payment intent, adding this customer to it. Then the payment method relates to the payment intent and payment intent relates to the customer.
Why there is a way to attach payment method to a stripe customer ?
@red roost
Thank you
Will it show some informations on the stripe customer page ?
Yes
If we have created a stripe customer, and when creating payment intent, adding this customer to it. Then the payment method relates to the payment intent and payment intent relates to the customer.
No the payment method is not attached to the customer after this flow. You would need to either call the Attach Payment Method Id yourself, or in step 2 of creating Payment Intent specifysetup_future_usage
Why there is a way to attach payment method to a stripe customer ?
It's a step and merchant can choose to call it or not to call it, based on their preference.
Hi @red roost I know why the old process can have payment method id first, it first calls POST /v1/payment_methods and get the id from response.
Thanks
But what information you pass in in that call?
curl https://api.stripe.com/v1/payment_methods
-u sk_test_xxxxxx:
-d type=card
-d "card[number]"=4242424242424242
-d "card[exp_month]"=9
-d "card[exp_year]"=2023
-d "card[cvc]"=314
@red roost
That's to pass a card and it's really insecure because it have Card Number directly on your server. It's only a demonstrate purpose code and should never be used
unless you are PCI DSS compliant
But if I use this with type=paynow, then it's ok right ? @red roost
I just need the payment method id, so I've tried
curl https://api.stripe.com/v1/payment_methods \
-u sk_test_xxxxxx: \
-d type=paynow
And I got the id from the response.
{
"id": "pm_1LmuL2AZHN2I64zmNxI46eJX",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"created": 1664348748,
"customer": null,
"livemode": false,
"metadata": {},
"paynow": {},
"type": "paynow"
}