PhonePe / PhonePePayment

PhonePe Intent SDK for iOS provides a simple integration that you can use in your iOS application to process your Transactions through the PhonePe ecosystem.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

{error: key_error_code:ERROR_B2B_API_RETURNED_ERROR, key_error_result:{"code":"401","success":false}, status: FAILURE}

amanji1208 opened this issue · comments

anybody can help me please, when i am hitting pay api i am getting this response.

I had the same issue on flutter, it was due to bad input, I was giving wrong body and salt
the correct body and salt:

String getSalt() {
String apiEndPoint = "/pg/v1/pay";
var salt = "099eb0cd-02cf-4e2a-8aca-3e6c6aff0399";
var index = 1;
return sha256
.convert(utf8.encode(getBody() + apiEndPoint + salt))
.toString() +
"###" +
index.toString();
}

String getBody() {
var body = {
"merchantId": "PGTESTPAYUAT",
"merchantTransactionId": "transaction_123",
"merchantUserId": "90223250",
"amount": 1000,
"mobileNumber": "9999999999",
"callbackUrl": "https://webhook.site/55d95b9b-bec9-491e-b257-cbaf0ff7aa7e",
"paymentInstrument": {"type": "UPI_INTENT", "targetApp": "com.phonepe.app"},
"deviceContext": {"deviceOS": "ANDROID"}
}; // Encode the request body to JSON
String jsonBody = jsonEncode(body);
String base64EncodedBody = base64Encode(utf8.encode(jsonBody));
return base64EncodedBody;
}

Are you still facing the issue ?

Do you have valid credentials like salt and salt index for creating the request?

Please contact merchant-integration@phonepe.com, and they will guide you through all details.

The code is the same. You need valid credentials to generate the request and change the server to production while initiating the SDK.

I am facing the same issue while in the process of integrating PhonePe for Subscription Payment

The code is the same. You need valid credentials to generate the request and change the server to production while initiating the SDK.

Could you please tell me how to do just that for Subscription Payments?

Subscription payment is not supported in the PhonPe Payment SDK. Please contact the merchant-integration@phonepe.com , they will guide you for the subscription payments.

Subscription payment is not supported in the PhonPe Payment SDK. Please contact the merchant-integration@phonepe.com , they will guide you for the subscription payments.

Thanks! Will do just that. You inout on the matter is much appreciated 😎✌️