Closed m-glebova closed 6 years ago
Hi Maryna,
I assume that you are using the custom integration in which you provide your own PaymentRequestDetailsListener
(see https://docs.adyen.com/developers/checkout/android-sdk/build-your-own-ui-android). If that's the case, you could create your PaymentRequest
object before the shopper has to select a payment method. Once you get the callback onPaymentMethodSelectionRequired
, you present the list of payment methods to the shopper, and only call the PaymentMethodCallback
once the shopper is ready to actually pay.
We've also recently released new endpoints to the Checkout API to allow for more control in the checkout flow. These endpoints give you full control over retrieving available payment methods and making the actual payment. These endpoints are however purely backend focused, and the Android SDK does not provide any UI for this flow. You can find more information about the new endpoints here: https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v32/paymentMethods
Let me know if this helps you! Regards, Timon
Hi @timon-langlotz, Thank you very much for the reply. The thing is that our server requires "payment_method" for the order creation, and Adyen library wants to know orderId before displaying payment methods. The endless loop :) But Checkout API perfectly meets our goals to get payment methods before order creation. Can you please clarify, what url should we use for production Checkout API? I see in the documentation, that it looks like https://[random]-[company name]-checkout-live.adyenpayments.com/checkout/services/PaymentSetupAndVerification/[version]/[method]. Is it the same Adyen url, that our backend server uses for setup and verify, from the Adyen support web console?
Regards, Maryna
Hi Maryna,
The URL you provided is correct, where method
should be paymentMethods
. You can use the endpoint to retrieve the payment methods. Make sure to pass in as many as possible of the parameters as described in https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v32/paymentMethods to have a consistent list of payment methods.
Disclaimer: The paymentMethods
endpoint wasn't really designed with your use-case in mind, but we don't see any issues in your approach.
Let us know if this worked for you!
Cheers, Timon
Hi @timon-langlotz, Thank you for the quick update, we are trying it now.
Regards, Maryna
Hi @timon-langlotz, I've tried /paymentMethod in the playground here https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v32/paymentMethods and it works ok. But using in the app and by using curl I receive 401 error - Unauthorized. Did I miss something? Do I need header the same as in the /setup and /verify methods? Tried with header in the app and without by using curl with no luck.
Hi @m-glebova,
to use the /paymentMethods
endpoint, you need to make a server-side request with the header x-api-key: <YOUR_API_KEY>
. You can find the API key in the Adyen customer area.
It might be that there are IP restrictions, so making a call from your local machine or directly from that app might not work.
Note: The /paymentMethods
call should never be made from an app in a live environment.
I would recommend to contact our support (support@adyen.com), they will have better insights into missing / incorrect configurations on your merchant account.
Let us know if you could work it out! Timon
Hi @timon-langlotz Thanks for the update. Already resolved this issue: it was wrong API_KEY. Now it works.
Note: The /paymentMethods call should never be made from an app in a live environment.
Do you mean we should use our own backend for this as a proxy? What are the risks if we call it directly from the app?
Thanks in advance, Maryna
Hi Maryna,
glad to hear that you could resolve the issue!
In order to make the call directly from the app, you would have to expose your private API key in the app. Then anybody could decompile your app and use that API key. Therefore the call must be made from your backend! Same applies to the /setup
and /verify
call by the way.
Cheers, Timon
Hi guys!
I am trying to implement the adyen api(C#.net) into my project and I am encountering the following issue:
An exception of type 'System.Net.WebException' occurred in AdyenPaymentGatewaySample.dll but was not handled in user code Additional information: The remote server returned an error: (401) Unauthorized.
Here is a code sample of the callback file:
var config = new Config(); config.MerchantAccount = "MyMerchantAccountName"; config.Password = "mypassword"; config.Username = "test"; config.Endpoint = "https://pal-test.adyen.com/pal/servlet/Payment/v30"; config.ApplicationName = "MyServername"; config.Environment = Test; config.SkinCode = "7A26B737";//test config.HmacKey = "7A26B737AN79CSpV87A7A26B737AN79CSpV87A7A26B737AN79CSpV87A";//test
var client = new Client(config);
var payment = new Payment(client);
var paymentRequest = new PaymentRequest
{
MerchantAccount = "MyMerchantAccountName",
Amount = new Amount("CAD", 5),
Card = new Card(Number: "4111111111111111", ExpiryMonth: "08", ExpiryYear: "2018", Cvc: "737", HolderName: "John Smith"),
Reference = "Merchant reference",
AdditionalData = new Dictionary<string, string>()
};
var paymentResult = payment.Authorise(paymentRequest);
return paymentResult;
Thanks in advance,
I don't believe this is supported by the v30 of the API. It was introduced in v32 and the nuget package has not been updated to support this yet.
Hi guys! We successfully integrated your library, customized the UI, but we are also requested to change the core flow of the payment. In particular, user should choose/edit payment method on a separate screen before actually going to the checkout. Currently we doesn't see any other way except of requesting payment methods with temporary orderId, then cancelling this request, and then creating the new final request. We also understand that there may be some risks as it is not native library flow. Please help, we need your advice and recommendation.
Thanks in advance, Maryna