Paypal payment : How to get success request when loading the paypal in webview

后端 未结 5 1644
萌比男神i
萌比男神i 2021-02-18 17:49

Edit:

After paypal login, I could successfully complete transaction.But I need to match the successUrl in paypal to verify both url is same and

5条回答
  •  既然无缘
    2021-02-18 18:51

    Paypal returns json response after successful payment like below

    {
      "client": {
        "environment": "sandbox",
        "paypal_sdk_version": "2.14.1",
        "platform": "Android",
        "product_name": "PayPal-Android-SDK"
      },
      "response": {
        "create_time": "2016-06-15T11:38:04Z",
        "id": "PAY-6CN54299U76194116K5QT4BY",
        "intent": "sale",
        "state": "approved"
      },
      "response_type": "payment"
    }
    

    You need to check response json object. if state is approved that means paypal payment is successful. Then you can check on Paypal website for current transactions.

    Make Sure you have followed below steps: 1) private static final int REQUEST_CODE_PAYMENT = 1; private static String CONFIG_ENVIRONMENT=PayPalConfiguration.ENVIRONMENT_SANDBOX; //It will be PayPalConfiguration.ENVIRONMENT_PRODUCTION for live mode. 2)

    // note that these credentials will differ between live & sandbox environments.
    private static final String CONFIG_CLIENT_ID = "ATBvU5urlaPOhpCrAhFsoG4u63RvNoKUocFPs9yR5q_sbM0yecZawUjoJhIilW8DNg5RrJcRHgRuEP_1";
    
    private static PayPalConfiguration config = new PayPalConfiguration()
                                        .environment(CONFIG_ENVIRONMENT)
                                        .clientId(CONFIG_CLIENT_ID)
                                                // The following are only used in PayPalFuturePaymentActivity.
                                        .merchantName("Example Merchant")
                                        .merchantPrivacyPolicyUri(Uri.parse("https://www.example.com/privacy"))
                                        .merchantUserAgreementUri(Uri.parse("https://www.example.com/legal"));
                                Intent intent = new Intent(getActivity(), PayPalService.class);
                                intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
                                getActivity().startService(intent);
    

提交回复
热议问题