#akdj16 - Apply customer balance

1 messages ยท Page 1 of 1 (latest)

ember nest
#

HI ๐Ÿ‘‹

#

That's a lot of text

#

Give me a sec to catch up

arctic hatch
#

Hi! thank you ๐Ÿ˜ƒ

ember nest
#

Okay what is the current state of the error?

arctic hatch
#

I did a lot test requests, maybe the customerID is useful too? cus_M8TLxrH9cI7ai2
the last request is req_hqJTEFIaEUVYQx

#

also I think I didn't succeed to set paymentIntent status to 'requires_action'

ember nest
#

I'm sorry I am somewhat confused by this wording.

arctic hatch
#

I'm sorry too..
what I try to said is, the first time when I tried to use the applyCustomerBalancecall, I received the error about the PaymentIntent status requires_confirmation is incorrect.
Then i did a lot of attempts to change to status, but I never succeed

ember nest
#

Can you share the request that returned that error?

arctic hatch
#

yes, here is it

ember nest
#

I'm sorry, the request ID. We cannot really work with a screenshot of code

arctic hatch
#

this one, req_47l28wfsAzQIBi ?

ember nest
#

That request did not result in an error

arctic hatch
#

but I have only this two requests... and there is the error in return of the script

ember nest
#

See the 200 OK on the left? That means this request was successful and did not result in an error. Are you looking at your Test mode data?

arctic hatch
#

yes

ember nest
#

But I want to back up and suggest you review Payment Intents in general. Because the status can only be changed by taking specific actions. You cannot manually update the status.
https://stripe.com/docs/payments/intents

arctic hatch
#

Indeed it not result in error, but why my script throw an error?

ember nest
#

Your script is making a different request. That is clear from the error message

craggy oriole
#

Hi there ๐Ÿ‘‹ taking over for snufkin

Give me a few minutes to get caught up.

arctic hatch
#

also the paymentIntent is not completed, it seems to be pending

#

Hi ! ๐Ÿ˜ƒ

craggy oriole
#

Hi! So I would recommend reviewing the Payment Intent docs that snufkin posted, because the error says exactly why it was thrown and you would know what to do from here if you understood how Payment Intents transition through statuses.

#

If you have any questions specifically about behavior, I can definitely help with those. Mostly it's hard to explain something that is already very well-documented in a Discord thread

arctic hatch
#

I read this doc, but I don't know how to enable the 3D secure process

#

is it the only action that can be set for using applyCustomerBalance?

#

ok I found how to use 3D secure, but is it the only action?

craggy oriole
#

What do you mean "the only action"?

arctic hatch
#

in the error, it said "You may only apply customer balance to a PaymentIntent with a status of requires_action" and I only find 3d secure as an action, so is it the only one available action?

craggy oriole
#

Action and status are 2 different things

arctic hatch
#

I means, is it the only one action that can change the status to requires_action?

craggy oriole
#

What's the payment method you're looking at? Do you have an ID?

arctic hatch
#

never mind, I just did a new attempt with

payment_method_options: {
      card: {
        request_three_d_secure: 'any',
      },
    }

in the paymentIntent creation, and I get the same result.. status still is requires_confirmation

#

my initial aim, is I want to use the customer balance

#

the paymentMethod id : pm_1LQEMdB5c8xuItaNHkn2p2Ic

craggy oriole
#

Sorry I meant, which payment intent are you looking at?

arctic hatch
#

by running the script I created a lot... pi_3LQEMdB5c8xuItaN01QJsap6 is the last one

craggy oriole
#

3DS is only going to be required if there is a Payment Method, so I think you may need to create a Payment Intent without an attached Payment Method. OUr docs talk about how to do this here: https://stripe.com/docs/payments/customer-balance#make-cash-payment

you have to specify
payment_method_data: { type: 'customer_balance', },

on the payment intent when you create it and only pass it a customer id

Learn how to use the customer balance with payments.

arctic hatch
#

Ok let me try ๐Ÿ˜ƒ

arctic hatch
#

Thank you! I succeed to applied the customer balance to the paymentIntent by removing the attached payment_method, but the applyCustomerBalance call have to be removed too :/

#

But new questions:

  • how can I set a specific amount to reduce with the customer_balance? I don't want to pay the whole amount of paymentIntent with the customer balance. (I thought that applyCustomerBalance is for that use, but it seems to be not the case..)

  • I noticed that there are two kinds of balance, the credit balance and the cash balance.. I thought the customer_balance is the same for invoice and paymentIntent.. as they are not the same, how to adjust balance value? Does Customer Balance Transaction API can be used for both?

craggy oriole
#

how can I set a specific amount to reduce with the customer_balance? I don't want to pay the whole amount of paymentIntent with the customer balance. (I thought that applyCustomerBalance is for that use, but it seems to be not the case..)
You would have to create the Payment Intent for that specific amount, then create a separate Payment Intent for the remainder

#

I noticed that there are two kinds of balance, the credit balance and the cash balance.. I thought the customer_balance is the same for invoice and paymentIntent.. as they are not the same, how to adjust balance value? Does Customer Balance Transaction API can be used for both?
Cash represents actual money that the user sent (for example, if they paid more than was required) and can be used to create refunds or apply to other payments. Credit represents how much is owed and is generally only used with Invoices and Subscriptions. It can also be adjusted arbitrarily without actually accepting/sending any money

#

They aren't used interchangeably in most cases, but there is some overlap in what they can do