#avneetsingh_11747
1 messages · Page 1 of 1 (latest)
Sorry for the delay! Metadata can be set on a PaymentIntent or an underlying Charge object. You can make update calls after payment to update metadata on either of these objects
Thanks a lot man!
Also, please share some details on customer field. Looks like it is empty in my dashboard. Where does it come from?
This may be populated with a customer email address or customer ID but only for successful payments or if a customer was passed when creating the PaymentIntent
We are using our own email API to send emails to customers. Can you please share documentation/example on how customer can be passed during payment intent creation. Thanks
Hello! I'm taking over and catching up...
When you create a Payment Intent you can set the customer property to the ID of a Customer: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-customer
Something like this?
String customerId = createCustomer("customer@example.com");
PaymentIntent paymentIntent = createPaymentIntent(1000, "usd", customerId);
No, you need to specify the customer property specifically. What language are you using?
java
For that you would need to use PaymentIntentCreateParams.builder() and then use .setCustomer(customerId).
Have a look at the example snippet here: https://stripe.com/docs/api/payment_intents/create?lang=java
Getting InvalidRequestException no such customer: 'test_customer'; resource_missing; request-id: req_vjDJL4TIsAALk5" with below code:
Stripe.apiKey = stripeSecret;
PaymentIntentCreateParams createParams = new PaymentIntentCreateParams.Builder()
.addPaymentMethodType("card")
.setAmount(request.getAmount())
.setCurrency(request.getCurrency())
.setCustomer("test_customer123")
.build();
RequestOptions requestOptions = RequestOptions.builder()
.setIdempotencyKey(UUID.randomUUID().toString())
.build();
PaymentIntent paymentIntent = PaymentIntent.create(createParams, requestOptions);
You need to specify a valid Customer ID. The string test_customer123 is not a valid Customer ID.
Even with a number, I am getting this:
"errors": [
{
"source": "com.stripe.exception.InvalidRequestException",
"errorCode": null,
"message": "No such customer: '1'; code: resource_missing; request-id: req_KsOr8zmy1OjBC3"
}
]
Please elaborate on a valid customer id
You can't just make up a Customer ID. You need to create a Customer using the API and use the ID you get back: https://stripe.com/docs/api/customers/create