Online-Payments / sdk-java

Other
0 stars 0 forks source link

Problem with testing integration with Payone #1

Closed DmitryGolubev closed 1 year ago

DmitryGolubev commented 1 year ago

Hello.

We do integration with Payone platform according to the scheme Mobile/Client Integration. We have implemented an IOS mobile app with sdk and backend system with sdk respectively. Currently we have started testing our integration using a test account. We are getting an error from the Payone API server side when making a payment. For testing we are using dummy cards(VISA, MasterCard) from the page. What could be the error?

For testing we use the host https://payment.preprod.payone.com/.

Java Create Payment code:

\** @param encryptedCustomerInput - encrypted card data(number, cvv, expiryDate) from IOS app *\ 
public void pay(@NonNull String encryptedCustomerInput) {
        long price = 100L;
        AmountOfMoney amount = new AmountOfMoney().withAmount(price).withCurrencyCode("EUR");
        CardPaymentMethodSpecificInput cardPaymentMethodSpecificInput = new CardPaymentMethodSpecificInput();
        cardPaymentMethodSpecificInput.setPaymentProductId(1);
        CreatePaymentRequest request = new CreatePaymentRequest();
        Order order = new Order().withAmountOfMoney(amount);
        request.setOrder(order);
        request.setEncryptedCustomerInput(encryptedCustomerInput);
        PaymentsClientInterface paymentClient = merchantClient.payments();
        try {
            log.info("Sending create payment to PayOne. Price - {}", price);
            // invoking PaymentsClientInterface#createPayment(CreatePaymentRequest request)
            paymentClient.createPayment(request); <---- error occurs here
        } catch (RuntimeException  e) {
            log.error("Could not create payment", e);
            throw e;
        }
    }

Payone API create payment response:

{
  "errorId": "92e4fe93-fea9-43b4-a583-0aaf4f006975",
  "errors": [
    {
      "errorCode": "40001135",
      "category": "PAYMENT_PLATFORM_ERROR",
      "code": "9999",
      "httpStatusCode": 403,
      "id": "AUTHENTICATION_FAILURE",
      "message": "",
      "retriable": false
    }
  ],
  "paymentResult": {
    "creationOutput": {},
    "payment": {
      "paymentOutput": {
        "amountOfMoney": {
          "amount": 100,
          "currencyCode": "EUR"
        },
        "references": {
          "merchantReference": "5bf787e2452f44528ede4b7c7126e0c6"
        },
        "acquiredAmount": {
          "amount": 0,
          "currencyCode": "EUR"
        },
        "customer": {
          "device": {
            "ipAddressCountryCode": "99"
          }
        },
        "cardPaymentMethodSpecificOutput": {
          "paymentProductId": 1,
          "card": {
            "cardNumber": "************4675",
            "expiryDate": "1225",
            "bin": "433026",
            "countryCode": "BE"
          },
          "fraudResults": {
            "fraudServiceResult": "no-advice",
            "cvvResult": "P"
          },
          "threeDSecureResults": {
            "eci": "92",
            "xid": "MzMxOTc1ODc5OQ=="
          },
          "acquirerInformation": {
            "name": "Easycash"
          }
        },
        "paymentMethod": "card"
      },
      "status": "REJECTED",
      "statusOutput": {
        "errors": [
          {
            "errorCode": "40001135",
            "category": "PAYMENT_PLATFORM_ERROR",
            "code": "9999",
            "httpStatusCode": 403,
            "id": "AUTHENTICATION_FAILURE",
            "message": "",
            "retriable": false
          }
        ],
        "isCancellable": false,
        "statusCategory": "UNSUCCESSFUL",
        "statusCode": 2,
        "isAuthorized": false,
        "isRefundable": false
      },
      "id": "3319758799_0"
    }
  }
}
online-payments-support-team commented 1 year ago

Hello Dmitry,

We had a closer look on your issue and the sample code you've provided. First thing that came to our attention is that you are instantiating a CardPaymentMethodSpecificInput where the PaymentProduct is being set but this object is never assigned to the CreatePaymentRequest object.

Another thing which is more important is that in order to make a basic create payment it is not enough to use Order with AmountOfMoney but also you'll have to assign a Customer object with proper Device in it.

You can find more info about the CreatePayment scenarios on our API Explorer site.

Let us know if this helps.

online-payments-support-team commented 1 year ago

Hello @DmitryGolubev,

We haven't got your feedback on the instructions provided from our side regarding your issue. We hope that the information was useful and you were able to resolve the issue you've reported.

We are going to close this issue for now. If you are still experiencing the same or similar issue please feel free to create a new issue and provide the details for it.

Thanks for the understanding. Kind regards