欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Adyen海外支付 - 获取支付方式列表

程序员文章站 2022-03-01 12:56:56
...

API Explorer | Adyen Docs

// Set your X-API-KEY with the API key from the Customer Area.
String xApiKey = "YOUR_X-API-KEY";
Client client = new Client(xApiKey,Environment.TEST);
Checkout checkout = new Checkout(client);
PaymentMethodsRequest paymentMethodsRequest = new PaymentMethodsRequest();
paymentMethodsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT");
paymentMethodsRequest.setCountryCode("NL");
paymentMethodsRequest.setShopperLocale("nl-NL");
Amount amount = new Amount();
amount.setCurrency("EUR");
amount.setValue(1000L);
paymentMethodsRequest.setAmount(amount);
paymentMethodsRequest.setChannel(PaymentMethodsRequest.ChannelEnum.Web);
PaymentMethodsResponse paymentMethodsResponse = checkout.paymentMethods(paymentMethodsRequest);
// Pass the response to your front end
  1. 一般国内使用Adyen等国外支付渠道的,业务都是针对多国的,所以系统多语言的适配,也是个问题,Adyen获取支付列表接口,提供了shopperLocal字段,可以传语言,返回翻译后的支付方式。
     
  2. 获取支付列表,到前端的刷新,渲染,都比较慢,可以将结果通过国家和语言作为key,存入redis。
     
  3. 支付列表,是根据商户号维度获取的,这里要提前规划,和后面的调用支付接口用到的商户信息统一。
     
  4. 新增支付方式,可以直接在Adyen商户后台配置,但有些渠道,有特殊要求,如支付方式对应的国家实体,google pay需要在google申请商户配置等。
     
  5. 之前Adyen的Api版本是17.1.0,在接入googlePay后,返回支付列表出现bug,Adyen官方在17.2.0中已修复。