lundi 3 avril 2017

Paypal future payments

I am using paypal checkout.js in an ember application. I create the payment using this code:

paypal.Button.render({
    env: 'sandbox', // sandbox | production
    payment: function() {
        return paypal.request.post('http://localhost:3000/paypal/create').then(function(res) {
            console.log('res')
            console.log(res);
            return res.payToken;
        });
    },
    onAuthorize: function(data, actions) {
        return paypal.request.post('http://localhost:3000/paypal/execute', {
            payToken: data.paymentID,
            payerId: data.payerID
        }).then(function (res) {
            console.log(res)
            document.querySelector('#paypal-button-container').innerText = 'Payment Complete!';
        });
    }

}, '#paypal-button-container');

And in the back end I used

def create authorization_code = '' correlation_id = ''

end

The problem now that I can't get authorization_code and correlation_id and when I searched about that, I found the majority of the solutions are that this kind of payments are only for mobile applications. So, Is that true? I can not use future payment with front-ends?

Thank you.




Aucun commentaire:

Enregistrer un commentaire