stripe checkout custom button not charging

前端 未结 2 1993
一个人的身影
一个人的身影 2021-01-02 21:22

I am trying to get Stripe\'s Checkout Custom Button to charge a credit card but all it does is minimize after I enter the credit card details. I am using the code found in t

2条回答
  •  醉话见心
    2021-01-02 22:03

    Finally got it to work. Had to change a bunch of it. Here is the code:

    Payment page

    charge.php

     $token,
        'amount'   => $amount,  
        'currency' => 'usd',
        'description' => $desc
        ));
    
        } catch(Stripe_CardError $e) {
    // The card has been declined
    }
    
    echo "

    Successfully charged $$realAmount!

    "; ?>

    I wish Stripe's documentation was more straightforward but this code handles the charge and it logs it on your dashboard.

提交回复
热议问题