hevin info
hevin info

Reputation: 19

I am trying to resolve phonePe payment integration error in flutter

key_error_code:ERROR_B2B_API_RETURNED_ERROR status: FAILURE | key_error_result:{"success":false,"code":"TOO_MANY_REQUESTS","message":"Too many requests. Please try again.","data":{}}

This is my base64 body: eyJtZXJjaGFudElkIjoiUEdURVNUUEFZVUFUIiwibWVyY2hhbnRUcmFuc2FjdGlvbklkIjoiTVQ3ODUwNTkwMDY4MTg4MTA0IiwibWVyY2hhbnRVc2VySWQiOiJNVUlEMTIzIiwiYW1vdW50IjoxMDAwLCJjYWxsYmFja1VybCI6Imh0dHBzOi8vd2ViaG9vay5zaXRlLzMyNzY3YjgzLTQ0MTUtNDc0ZC1hMzYxLTg3OGVkNjY2ZTI5ZCIsIm1vYmlsZU51bWJlciI6Ijk5OTk5OTk5OTkiLCJwYXltZW50SW5zdHJ1bWVudCI6eyJ0eXBlIjoiUEFZX1BBR0UifX0=

Upvotes: 0

Views: 8832

Answers (3)

shiva reddy
shiva reddy

Reputation: 25

You need to use a different key that will fix the issue. If you are using test key use this merchnat key : PGTESTPAYUAT86 and salt key : 96434309-7796-489d-8924-ab56988a6076

Merchant key : PGTESTPAYUAT86 
Salt Key : 96434309-7796-489d-8924-ab56988a6076

Upvotes: 0

Shubham Pandey
Shubham Pandey

Reputation: 219

This is not any issue only you have to change the key. If you are using test key use this merchnat key : PGTESTPAYUAT86 and salt key : 96434309-7796-489d-8924-ab56988a6076

Merchant key : PGTESTPAYUAT86 
Salt Key : 96434309-7796-489d-8924-ab56988a6076

Code Snippet :


getChecksum() {
    final requestData = {
      "merchantId": merchantId,
      "merchantTransactionId": transactionId,
      "merchantUserId": "90223250",
      "amount": 1000,
      "mobileNumber": "9999999999",
      "callbackUrl": callbackUrl,
      "paymentInstrument": {"type": "PAY_PAGE"}
    };

    String base64Body = base64.encode(utf8.encode(json.encode(requestData)));

    checksum =
    '${sha256.convert(utf8.encode(base64Body + apiEndPoint + saltKey))
        .toString()}###$saltIndex';

    return base64Body;
  }


    body = getChecksum().toString();




 var response = PhonePePaymentSdk.startTransaction(
          body, callbackUrl, checksum,"");
      response
          .then((val)

      async
      {
          if (val != null) {
            String status = val['status'].toString();
            String error = val['error'].toString();

            if (status == 'SUCCESS') {
              result = "Flow complete - status : SUCCESS";

             await checkStatus();
            } else {
              result =
              "Flow complete - status : $status and error $error";
            }
          } else {
            result = "Flow Incomplete";
          }
      })
          .catchError((error) {
        handleError(error);
        return <dynamic>{};
      });

You can also check this video : https://www.youtube.com/watch?v=n3j0DOmHcFA&pp=ygUgZmx1dHRlciBwaG9uZXBlIHBheW1lbnQgZ2F0ZXdheSA%3D

Upvotes: 1

Rashed Sahaji
Rashed Sahaji

Reputation: 99

I have mailed phonepe team. They suggested to use PGTESTPAYUAT86 instead of PGTESTPAYUAT.

Kindly use below Sandbox credentials to avoid too many requests 429 error:

MID: PGTESTPAYUAT86 Salt Index: 1 Salt Key: 96434309-7796-489d-8924-ab56988a6076

UAT Sandbox: Please use UAT Sandbox for testing: https://developer.phonepe.com/v1/docs/standard-uat-sandbox

The UAT Sandbox is used to simulate the end-to-end payment flows for online merchants. A template is a mapping of APIs and their mock responses using which merchants can simulate the scenarios like Success, Failure, and Pending.

Upvotes: 9

Related Questions