2017-04-12 4 views
1

私はpaypals簡単なエクスプレスチェックアウトのjavascriptを持っており、私はそれをテストしている間、私は下のコードに返信urlを追加する方法をfiqureすることはできません。paypalのjavascript/rest express checkoutへの返信URLの追加方法簡単なintergration

Paypalデベロッパーサイトのアプリの&の資格情報で、私はREST APIアプリを作成してそこに返信URLを追加しましたが、これは単純なjavascript Express Checkoutの統合では以下のようには機能しません。

返信とキャンセルのURLを渡しても、基本クライアントの統合でこれを許可しないのですか?

愚かな質問をして申し訳ありません

、それだけでドキュメントがすべてでは良いことではありませんpalpaysと見

<script src="https://www.paypalobjects.com/api/checkout.js"></script> 

<div id="paypal-button-container"></div> 

<script> 

// Render the PayPal button 

paypal.Button.render({ 
    // Set your environment 

    env: 'sandbox', // sandbox | production 

    // PayPal Client IDs - replace with your own 
    // Create a PayPal app: https://developer.paypal.com/developer/applications/create 

    client: { 
     sandbox: 'sandbox', 
     production: 'production' 
    }, 
    // Wait for the PayPal button to be clicked 

    payment: function() { 

     // Make a client-side call to the REST api to create the payment 

     return paypal.rest.payment.create(this.props.env, this.props.client, { 
      transactions: [ 
       { 
        amount: {total: '10.99', currency: 'USD'} 
       } 
      ] 
     }); 
    }, 
    // Wait for the payment to be authorized by the customer 

    commit: true, // Optional: show a 'Pay Now' button in the checkout flow 

    onAuthorize: function (data, actions) { 

     // Execute the payment 

     return actions.payment.execute().then(function() { 
      // Show a success page to the buyer 
     }); 
    } 

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

+0

これはローカルで実行しようとしていますか?私はあなたがPaypalへの電話をしていると信じています。あなたが提供したURLを登録したDNSと呼んでいます。 –

+0

これは私が現在取り組んでいるウェブサイトに掲載されています。そのちょうど私は戻り値のURLを取得することができない、またはhttps://example.com/paypal-successのようにそれを追加する方法をfiqure – xop32

答えて

0

同じ基本的なことを行うためにさまざまなオプションのそこに多くをグーグル投げた私はあきらめましたこのウィジェットは限られていて地獄のバグが多いので。しかし、私はあなたがonAuthorizeコールバックハンドラ内でそれを行うことによってリダイレクトすると思います。

paypal.Button.render({ 
    // etc... 
    onAuthorize: function (data, actions) { 
     return actions.payment.execute().then(function() { 
      // redirect to success page 
     }).catch(function(err) { 
      // redirect to error page 
     }); 
    } 
}, '#paypal-button-container'); 
+0

私は同じことを考えていた、あなたは基本的な統合は簡単だろうと思いますしかし、いろいろなブラウザでのテストでは、一度動作しないと、ポップアップライトボックスに異なるCSSスタイルが表示されます。これを破棄して、PHPの完全な残りのAPIの統合を試してみます – xop32

関連する問題