#Hakan de Chargemap

1 messages · Page 1 of 1 (latest)

tribal sirenBOT
bleak hinge
#

I can try, what's the specific question?

trim meadow
#

Hey, so we have this piece of code

    $paymentIntent = $this->stripeFacade->createPaymentIntent([
        'payment_method_types' => StripeFacade::getPaymentMethodFromCountryCode($user->getBillingAddress()->getCountryCode()),
        'amount' => $payFromJwtRequest->getAmount(),
        'currency' => 'eur',
        'customer' => $stripeCustomerId,
        'description' => $payFromJwtRequest->getLabel(),
        'setup_future_usage' => 'off_session',
        'metadata' => $metadata,
    ], $payFromJwtRequest->getUuid());
#

so we are using the PHP SDK

#

and using PaymentIntent::create method

#

as you may see we have the following keys set :

  • payment_method_type
  • amount
  • currency
  • customer
  • description
  • setup_future_usage
  • metadata
#

this works fine and we do get a stripe ressource that we are able to display

#

however we would like to, when a user already have a payment method, set the payment in the parameters of the payment intent create request

#

the goal is to hide the credit card setup form

#

for this, we do set the "payment_method" property, with a value, for instance "card_1CIG51FigtNEoosZtwA8EuTf"

#

however, the form remains as is, meaning we still have all the fields that must be filled by the user

#

I think I'm missing something here

bleak hinge
#

well if you are passing a payment_method then you need to change the code around this so that you're not even touching the frontend.

To charge the saved card you would pass payment_method and confirm=>true, that charges the saved card and then you can check immediately if it succeede

trim meadow
#

Hmmm we still would like to display a "pay" button so that the user actually do the payment

#

going for a lunch break but will be back in 1 hour or so

bleak hinge
#

the thread will be closed by then

bleak hinge