加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular – Paypal Plus成功数据

发布时间:2020-12-17 07:09:56 所属栏目:安全 来源:网络整理
导读:我在角度项目中使用Paypal Plus.一切都运作正常. 如何确认付款成功?我必须在数据库中保存哪些数据.总之,我在等待哪些数据成功? div id="payments-container"/div export class PaypalComponent implements OnInit { paypalConfig = { env: 'sandbox',clien
我在角度项目中使用Paypal Plus.一切都运作正常.

如何确认付款成功?我必须在数据库中保存哪些数据.总之,我在等待哪些数据成功?

<div id="payments-container"></div>
export class PaypalComponent implements OnInit {
  paypalConfig = {
    env: 'sandbox',client: {
      sandbox: 'ATvgtyEZznsHf...',production: '<insert production client id>'
    },style: {
      layout: 'vertical',label: 'pay',size: 'responsive',shape: 'rect',color: 'gold'
    },commit: true,payment: (data,actions) => {
      return actions.payment.create({
        payment: {
          transactions: [{
            amount: {
              total: 10.5,currency: "EUR",}
          }]
        }
      });
    },onAuthorize: (data,actions) => {
      return actions.payment.execute().then((response) => {
        console.log('response',response);
        console.log('data',data);
        console.log('actions',actions);
      });
    },onCancel: (data,actions) => {
      console.log('Canceled!');
    }
  };

  ngOnInit() {
    paypal.Button.render(this.paypalConfig,'#payments-container');
  }
}

解决方法

从 docs开始:

A successful response returns confirmation of the transaction,with the approved state and a transaction ID. See the complete list of 07001 in the Payments API Reference.

具体看看response docs:

id string

The ID of the payment. Read only.

intent enum

The payment intent. Value is: sale. Makes an immediate
payment. authorize. Authorizes a payment for capture later. order.
Creates an order. Possible values: sale,authorize,order.

payer object

The source of the funds for this payment. Payment method
is PayPal Wallet payment or bank direct debit.

application_context object

Use the application context resource to customize payment flow
experience for your buyers.

transactions array (contains the transaction object)

An array of payment-related
transactions. A transaction defines what the payment is for and who
fulfills the payment. For update and execute payment calls,the
transactions object accepts the amount object only.

state enum

The state of the payment,
authorization,or order transaction. Value is:

  • created. The
    transaction was successfully created.

  • approved. The customer approved
    the transaction. The state changes from created to approved on
    generation of the sale_id for sale transactions,authorization_id for
    authorization transactions,or order_id for order transactions.

  • failed. The transaction request failed. Read only.

Possible values: created,approved,failed.

experience_profile_id string

The PayPal-generated ID for the
merchant’s payment experience profile. For information,see create web
experience profile. note_to_payer string A free-form field that
clients can use to send a note to the payer. Maximum length: 165.

redirect_urls object

A set of redirect URLs that you provide for
PayPal-based payments.

failure_reason enum

The reason code for a
payment failure. Read only.

Possible values: UNABLE_TO_COMPLETE_TRANSACTION,
INVALID_PAYMENT_METHOD,PAYER_CANNOT_PAY,CANNOT_PAY_THIS_PAYEE,
REDIRECT_REQUIRED,PAYEE_FILTER_RESTRICTIONS.

create_time string

The date and time when the payment was created,in
Internet date and time format. Read only.

update_time string

The date and time when the payment was updated,in
Internet date and time format. Read only.

links array (contains the link_description object)

An array of request-related HATEOAS links. Read only.

你肯定会在寻找获得批准的州.

根据您的审核需求,您可能希望保存任何或所有其他字段. id,intent,payer,transactions和failure_reason至少都值得考虑.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读