Go Живите с помощью умных кнопок Paypal - PullRequest
0 голосов
/ 16 июня 2020

У меня есть это в моих умных кнопках:

<script src="https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></script>

<script>
paypal.Buttons({
    createOrder: function (data, actions) {
        return actions.order.create({
            purchase_units: [
                {
                    reference_id: "PUHF",
                    description: "Sporting Goods",

                    custom_id: "CUST-HighFashions",
                    soft_descriptor: "HighFashions",
                    amount: {
                        currency_code: "GBP",
                        value: "230.00",
                        breakdown: {
                            item_total: {
                                currency_code: "GBP",
                                value: "180.00"
                            },
                            shipping: {
                                currency_code: "GBP",
                                value: "30.00"
                            },
                            handling: {
                                currency_code: "GBP",
                                value: "10.00"
                            },
                            tax_total: {
                                currency_code: "GBP",
                                value: "20.00"
                            },
                            shipping_discount: {
                                currency_code: "GBP",
                                value: "10"
                            }
                        }
                    },
                    items: [
                        {
                            name: "T-Shirt",
                            description: "Green XL",
                            sku: "sku01",
                            unit_amount: {
                                currency_code: "GBP",
                                value: "90.00"
                            },
                            tax: {
                                currency_code: "GBP",
                                value: "10.00"
                            },
                            quantity: "1",
                            category: "PHYSICAL_GOODS"
                        },
                        {
                            name: "Shoes",
                            description: "Running, Size 10.5",
                            sku: "sku02",
                            unit_amount: {
                                currency_code: "GBP",
                                value: "45.00"
                            },
                            tax: {
                                currency_code: "GBP",
                                value: "5.00"
                            },
                            quantity: "2",
                            category: "PHYSICAL_GOODS"
                        }
                    ],
                    shipping: {
                        method: "United States Postal Service",
                        address: {
                            name: {
                                full_name: "John",
                                surname: "Doe"
                            },
                            address_line_1: "123 Townsend St",
                            address_line_2: "Floor 6",
                            admin_area_2: "San Francisco",
                            admin_area_1: "CA",
                            postal_code: "94107",
                            country_code: "UK"
                        }
                    }
                }
            ]
        });
    },
    onApprove: function (data, actions) {
        return actions.order.capture().then(function (details) {
            alert('Transaction completed by ' + details.payer.name.given_name);
            // Call your server to save the transaction

        });
    }
}).render('#paypal-button-container');
</script>

Я вошел в свою учетную запись PayPal в песочнице, чтобы увидеть, прошли ли тестовые деньги, через которые он прошел. Но как сделать эти умные кнопки go живыми?

Что мне нужно изменить?

Также, если я использую умную кнопку для ввода данных кредитной карты, должен ли пользователь иметь счет PayPal для оплаты кредитной картой с помощью смарт-кнопки для кредитных карт?

1 Ответ

1 голос
/ 17 июня 2020
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...