#ASittingDuck

1 messages ยท Page 1 of 1 (latest)

rugged roostBOT
sonic salmon
#

and here is the method that is creating the payment method

const method = await stripe.createPaymentMethod({
    type: 'card', card: elements.getElement(CardElement), billing_details: {
        name: `${customer.firstName} ${customer.lastName}`, address: {
            city: customer.city, line1: customer.address, postal_code: customer.zip, state: customer.state,
        }, email: customer.email, phone: customer.phone,
    },
});
upper laurel
sonic salmon
#

payment method create = req_5npH6A4UT5SGaz
customer create = req_Biz3uqrqfOUsWn

#

@upper laurel not sure if you were getting notified so sorry if I pinged you unneccisarily

upper laurel
#

No worries, there's just a number of active threads that are all mine so it might take a minute

sonic salmon
#

Thanks

upper laurel
#

I see the PM is attached to the Customer, it's just not in the API response

#

But both the customer.created and payment_method.attached events fired in response to the Customer creation request

sonic salmon
#

Ok so then there is another issue then, When I use this method

export async function updatePaymentIntent ({
    // Required properties
    id,
    
    // Required shipping property
    shipping = {},
    
    // Optional properties, listed alphabetically
    amount = 0,
    currency = 'usd',
    customer = {},
    description = '',
    metadata = {},
    receiptEmail = '',
    setupFutureUsage = 'off_session',
    statementDescriptor = '',
    statementDescriptorSuffix = '',
}) {
    const options = {};
    if (amount) options.amount = amount;
    if (currency) options.currency = currency;
    if (customer) options.customer = customer.id;
    if (description) options.description = description;
    if (metadata) options.metadata = metadata;
    if (receiptEmail) options.receipt_email = receiptEmail;
    if (shipping) options.shipping = shipping;
    if (statementDescriptor) options.statement_descriptor = statementDescriptor;
    if (statementDescriptorSuffix) options.statement_descriptor_suffix = statementDescriptorSuffix;
    if (setupFutureUsage !== null) options.setup_future_usage = setupFutureUsage;
    return await StripeAPI.paymentIntents.update(id, options);
}

its not using the payment method from the customer, do I need to ALSO add the payment method on this command if I have set the customer?

#

req_2Ip2703pLtf94R

upper laurel
#

You have attached the PM to the Customer but it's not set as the default payment method.

sonic salmon
#

Ok so how do I do that

#

Is that under invoice_settings?

sonic salmon
#

OK that s where I was having an issue, thank you!

upper laurel
#

Happy to help ๐Ÿ™‚

sonic salmon
#

Hmmm still not working

#

even though the customer has a default payment method

#

Just want to make sure this is working before going to my next step because I am ALSO going to pass this payment method over to wordpress since will be used for subscriptions

#

omg, I just realized the post to update the PI isn't getting the custoemr

upper laurel
#

AH, that might make it hard to get the default PM then.

sonic salmon
#

That's true BUUUUUT, now if you look at
req_QxE4PnS3u7SWoB I have made a change where the customer is now updated and STILL its not getting the payment method in req_XuDoPUNm47PIu3

upper laurel
sonic salmon
#

OK thank you!

upper laurel
#

Also I'm a little confused that you were passing the setup_future_usage parameter. Normally that is used when you are creating the PM as part of the Payment Intent confirmation process

sonic salmon
#

I was trying to MAKE SURE the payment method is available to be used on another site, since this is for a SALES site used exclusively by sales associates

#

Because those cards would be AUTOMATICALLY charged for subscriptions that they sales person signs them up for as well.

upper laurel
#

Okay but that parameter has no effect unless you are creating the PM as part of the intent confirmation. It needs to be part of how you set up the Payment Method

sonic salmon
#

I think I may have done that, let me check

#

gosh dang it I don't think I did

#

thanks for pointing that out, I will work on that later

upper laurel
#

Is your user on-session when you are creating the Customer and PM?

sonic salmon
#

Yes, the sales agent is running the transaction and getting the card information from the customer via telecommuncations like phone or zoom

upper laurel
#

Oh....

#

We have a custom flow for that called MOTO (Mail Order/Telephone Order) but it's something you would need to request access to

sonic salmon
#

Interesting, the hard part about THAT is that this card information is ALSO used another site.

our sales site is sales.markjkohler.com
and the main site is markjkohler.com

customers can purchase the same products and subscriptions on woocommerce, but because woocommerce doesn't have a remote payment rest API option, and instead wants a payment method sent to them for recurring payments of items that are subscriptions, we have to run the payment information on stripe, and THEN send over the payment method id to woocommerce when subscriptions are being set up

#

luckily ALL transactions are USA based only

upper laurel
#

Otherwise, it might make sense to use Setup Intents to create the Payment Method and attach it to the Customer that way since it has some of the config options for better off_session payments: https://stripe.com/docs/payments/save-and-reuse