#AndreaDev2023

1 messages · Page 1 of 1 (latest)

proven bladeBOT
timber agate
#

hello! what do you mean by it has an invalid id?

void inlet
#

hi, thisis

#

this is the error that return

#

when i try to create sub

timber agate
#

there's no error in the request id that you provided

#

what's the actual error message or request id where you received that error?

void inlet
#

this the id req_F0qU1qkSjc7vLM

#

Missing required param: customer.

#

What should I put in the customer parameter?

timber agate
#

you should probably be inputting the id of the Customer. But the request that you've shared doesn't have any errors in the response. Without specific details of your code for example and/or the correct request id where you're getting this error, there's not much more I can comment on

void inlet
#

req_PeQ8szVMfNQF5Q

proven bladeBOT
timber agate
#

once you've done that, then you can pass in the Customer id in customer for that request

void inlet
#

$paymentMethod = \Stripe\PaymentMethod::retrieve($paymentMethodId);
$subscription = \Stripe\Subscription::create([
'customer' => $paymentMethod->customer,
'items' => [['price' => $amount]],
'payment_behavior' => 'default_incomplete',
'expand' => ['latest_invoice.payment_intent'],
]);

#

'customer' => $paymentMethod->customer,

#

this is correct?

#

i pass the paymentId to customer parameter

leaden mauve
#

If that parameter is a cus_xxx ID, sure

void inlet
#

no

#

i create the customer id with the var $paymentMethod in the backend code, not pass var customer by frontend

#

it's wrong?

leaden mauve
#

Yes, the customer parameter expects a cus_xxx ID

void inlet
#

in react is correct this:

const customer = await stripe.customers.create({
email: 'customer@example.com',
name: 'John Doe',
});

leaden mauve
#

That looks like a valid API call, yes

void inlet
#

i use the react-stripe-js

#

and the test key

leaden mauve
#

Well that's an API request tat requires your secret key so you should be making that from a server environment like Node (not React)

void inlet
#

{
"error": "No such customer: 'pm_1NTLbXJIIISYEGLzHx1n7Qj6'"
}

leaden mauve
#

Seems reasonable considering that's not a cus_xxx ID, but a Payment Method ID

void inlet
#

$stripe->customers->create([
'description' => 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)',
]);

in this function can pass paymentId for create id customer?

leaden mauve
#

No, that API will return a response that includes an id field which is the cus_xxx ID you need

void inlet
#

What parameters should I pass to create the customer id?

#

email ?

leaden mauve
void inlet
#

{
"paymentMethodId": "pm_1NTLogJIIISYEGLzqe6YJ00t",
"amount": 9900,
"customer": "cus_OFrXav2zJKkLkh"
}

this is the object that pass to server, but return error: Missing required param: customer.

leaden mauve
void inlet
#

req_8E8Ypg5sxa4u4d

proven bladeBOT
tribal void
#

Hi! I'm taking over this thread.

#

The error message is pretty clear:

Missing required param: customer."

void inlet
#

Error creating subscription: The price parameter should be the ID of a price object, rather than the literal numerical price

tribal void
void inlet
#

another error

tribal void
void inlet
#

req_toom1dndS9xR5z

tribal void
void inlet
#

do i have to create the products inside the stripe dashboard?