Как я могу получить ID транзакции PayPal в JS - PullRequest
0 голосов
/ 26 октября 2018

У меня есть эта проблема, нужен идентификатор транзакции. Это мой код:

payment: 
        function(data, actions) 
        {
            var hola = 0.01;
            return actions.payment.create(
            {
                payment: 
                {
                    transactions: 
                    [{
                        amount: 
                        {
                            total: hola,
                            currency: 'MXN',
                            details: 
                            {
                                subtotal: '0.01'
                            }
                        },
                        //invoice_number: '12345', Insert a unique invoice number
                        payment_options: 
                        {
                            allowed_payment_method: 'INSTANT_FUNDING_SOURCE'
                        },
                        item_list: 
                        {
                            items: 
                            [
                                {
                                    name: 'carrito del cafe',
                                    description: 'tu pedido del cafe',
                                    quantity: '1',
                                    price: '0.01',
                                    sku: '1',
                                    currency: 'MXN'
                                }
                            ],

                            shipping_address: 
                            {
                                recipient_name: 'Brian Robinson',
                                line1: '4th Floor',
                                line2: 'Unit #34',
                                city: 'San Jose',
                                country_code: 'US',
                                postal_code: '95131',
                                phone: '011862212345678',
                                state: 'CA'
                            }
                        }

                    }],
                }
            });
        },

        onAuthorize: function(data, actions) 
        {
            return actions.payment.execute().then(function(data, actions) 
            {
                var idt = actions.payment.transactions[0].related_resources[0].sale.id;
                window.alert(idt);
            });
        }

Мне нужно увидеть транзакцию ID в onAuthorize; кто-нибудь может мне помочь?

...