doucaishou0074 2018-06-12 12:29
浏览 121

Php Paypal Express结账:如何通过服务器端请求付款

Hello I am using Express checkout for my one of project. This is first time i am working with paypal.

I have following code.

var CREATE_PAYMENT_URL  = '<?php echo site_url().'/cart/' ?>create-payment';
    var EXECUTE_PAYMENT_URL = '<?php echo site_url().'/cart/' ?>execute-payment';
    paypal.Button.render({

        env: 'sandbox', // sandbox | production
        intent:'authorize',
        style: {
            size: 'medium', // small | medium | large | responsive
            shape: 'rect', // pill | rect
            tagline: false
        },

        funding: {
            allowed: [paypal.FUNDING.CREDIT]
        },
        client: {
            sandbox: '<?php echo $this->config->item('clientId'); ?>',
        },

        payment: function (data, actions) {
            return paypal.request.post(CREATE_PAYMENT_URL).then(function(data) {
                return data.id;
            });

        },

        // Wait for the payment to be authorized by the customer
        onAuthorize: function (data, actions) {
            return paypal.request.post(EXECUTE_PAYMENT_URL, {
                paymentID: data.paymentID,
                payerID:   data.payerID
            }).then(function() {
                alert('payment completes!');
            });

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

Now i want to pay through server side api call. I searched a lot but not getting proper documents for it. I don't know how to pay through server side api.

Don't know what is wrong with documents. They are never adding proper information for integration.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥15 帮我写一个c++工程