- From: Rouslan Solomakhin <notifications@github.com>
- Date: Fri, 25 Mar 2016 10:34:39 -0700
- To: w3c/browser-payment-api <browser-payment-api@noreply.github.com>
Received on Friday, 25 March 2016 17:35:13 UTC
> Need to add a return data method.
The Android payment application will need to call its [Activity.setResult()](http://developer.android.com/reference/android/app/Activity.html#setResult(int)) method to pass payment response into Chrome. The payment response should be a string.
````Java
Intent result = new Intent("org.w3.intent.action.PAY");
result.putExtra("PaymentResponse", "{"
+ " \"cardNumber\": \"4111111111111111\","
+ " \"cardholderName\": \"Bob J. Paymentman\","
+ " \"expiryYear\": \"12\","
+ " \"expiryYear\": \"2016\","
+ " \"cardSecurityCode\": \"123\""
+"}");
setResult(Activity.RESULT_OK, result);
finish();
````
Chrome will parse this string into a JavaScript object and will use it to resolve the JavaScript promise returned from `PaymentRequest.show()`.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/50#issuecomment-201380720
Received on Friday, 25 March 2016 17:35:13 UTC