lundi 7 octobre 2019

How fix No such payment_method error with stripe-php

I use "stripe/stripe-php": "^7.2" in my laravel 5.8 app in 2 places with testing keys: 1) express payments and that works ok 2) I started making subscription in other page with similar code and making subscription I got error : No such payment_method: tok_1FRCLkI5xQuRgDRPpX22Y64B. Searching in net I found possible reason of this error that invalid keys are used, but checking it I see valid keys and I wonder how 1 page works ok, second fails, but they seems identical :

VALID page with express payment has code:

<div class="row row_content_centered p-3 m-3" style="justify-self: flex-start;">
    <form action="http://local-votes.com/stripe_express_payment_callback" method="GET">
        <script src="https://checkout.stripe.com/checkout.js"
                class="stripe-button active"
                data-key="pk_test_NNNNNNNN"
                data-amount="260"
                data-name="Select &amp; Vote"
                data-description=" selected 2 services"
                data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                data-locale="auto"
                data-currency="usd"
        >
        </script>
        <button type="submit" class="stripe-button-el" style="visibility: visible;"><span style="display: block; min-height: 30px;">Pay with Card</span>
        </button>
    </form>
    <button type="button" class="btn btn-inverse" onclick="javascript:document.location='http://local-votes.com/home'" style="margin-right:50px;"><span
            class="btn-label"><i class="fa fa-arrows-alt"></i></span> &nbsp;Cancel
    </button>&nbsp;&nbsp;

</div>

Invalid page with subscription has code :

<form action="/subscribe_process" method="post">
    <input type="hidden" name="_token" value="mjnmminrSADnv2Rpl5jTzPzyGl9mcqvMQGBlrLfy">
    <script
            src="https://checkout.stripe.com/checkout.js"
            class="stripe-button"
            data-key="pk_test_NNNNNNNN"
            data-amount="987"
            data-name="Select &amp; Vote"
            data-description="Online course about integrating Stripe"
            data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
            data-locale="auto"
            data-currency="usd">
    </script>

My private key is not tok_1FRCLkI5xQuRgDRPpX22Y64B as in error. Any hints? If there is a way of debugging the errors ?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire