MasterCard Sample Code Sample_REST-JSON_PHP error Invalid MerchantID - php

I am asking for help on an error I got when I try to integrate the MasterCard Payment Gateway Sample Code:
Gateway sample code link: https://ap-gateway.mastercard.com/api/documentation/downloads/example/Sample_REST-JSON_PHP.zip?locale=en_US
I configure the following field in the configuration.php
// Base URL of the Payment Gateway. Do not include the version.
$configArray["gatewayUrl"] = "https://ap-gateway.mastercard.com/api/rest/";
// Merchant ID supplied by your payments provider
$configArray["merchantId"] = "[INSERT-MERCHANT-ID]";
// API username in the format below where Merchant ID is the same as above
$configArray["apiUsername"] = "merchant.[INSERT-MERCHANT-ID]";
// API password which can be configured in Merchant Administration
$configArray["password"] = "";
I am pretty sure my Merchant ID, which is provided by a financial provider, is correct. However, I got the following error, could you please help to advise? Thanks.
{
"error": {
"cause": "INVALID_REQUEST",
"explanation": "Value '[INSERT-MERCHANT-ID]' is invalid. No valid Merchant Acquirer Relationship available",
"field": "merchantId",
"validationType": "INVALID"
},
"result": "ERROR"
}
Regards,
Carlos

You need the merchantId from a payment service provider. It says as much in the error.

Related

PayPal API - CURRENCY_NOT_ALLOWED

I am using the PHP PayPal REST API for credit card payments and a sandbox account and I get this error:
PayPal\Core\PayPalHttpConnection :
ERROR: Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment.
{
"name":"CURRENCY_NOT_ALLOWED",
"message":"Currency is not supported",
"information_link":"https://developer.paypal.com/webapps/developer/docs/api/#CURRENCY_NOT_ALLOWED",
"debug_id":"308d4b24ea4b5"
}
The "information_link" they provide does not provide any information whatsoever about CURRENCY_NOT_ALLOWED and what I found on another page of theirs is "more than helpful": Currency is not supported You are using a currency that is not currently supported.
The problematic currency is NOK, while EUR seems to work just fine.
Any idea on how to fix this?
Please check your paypal sendbox account address zone. May be it's not valid for NOK. For more details you can check it here :- https://developer.paypal.com/docs/classic/api/currency_codes/

Stripe charge card get fatal error with php rest api

I am using stripe charge card api for card payment. Token successfully created and this information goes to stripe server also. But when go for charge payment it give fatal error.
I am using amazone ubuntu instance for publish my website.
My php code is :-
$token=$this->input->post('stripeToken');
var_dump($token);
\Stripe\Stripe::setApiKey("xxx");
// Get the credit card details submitted by the form
//$token = $_POST['stripeToken'];
// Create the charge on Stripe's servers - this will charge the user's card
try {
$charge = \Stripe\Charge::create(array(
"amount" => 100, // amount in cents, again
"currency" => "usd",
"source" => $token,
"description" => "Example charge"
));
} catch(\Stripe\Error\Card $e) {
// The card has been declined
}
It give fatal error.
Fatal error: Uncaught exception 'Stripe\Error\ApiConnection' with message 'Could not connect to Stripe
(https://api.stripe.com/v1/charges). Please check your internet
connection and try again. If this problem persists, you should check
Stripe's service status at https://twitter.com/stripestatus, or let us
know at support#stripe.com. (Network error [errno 28]: Connection
timed out after 30055 milliseconds)' in
/opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php:216
Stack trace: #0
/opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php(178):
Stripe\HttpClient\CurlClient->handleCurlError('https://api.str...',
28, 'Connection time...') #1
/opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/ApiRequestor.php(184):
Stripe\HttpClient\CurlClient->request('post', 'https://api.str...',
Array, Array, false) #2
/opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/ApiRequestor.php(59):
Stripe\ApiRequestor->_requestRaw('post', '/v1/charges', Array, Ar in
/opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php
on line 216
I don't know the reason behind that.
The message shows Network error [errno 28], which is a curl error, defined as a CURLE_OPERATION_TIMEDOUT error. This is a connection error.
Connection errors are usually due to security group settings and not allowing outbound https, in this case to the API endpoint (https://api.stripe.com/v1/charges).
Can you try to curl https://api.stripe.com/v1/charges and confirm you can connect?
You should get the following:
{
"error": {
"type": "invalid_request_error",
"message": "You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/d
ocs/api#authentication for details, or we can help at https://support.stripe.com/."
}
}
If you do not get that response the command line on your server, then your code will not be able to connect either. Review your outgoing security group settings, and allow outbound HTTPS to the IP of the endpoint, or 0.0.0.0/0.

Payeezy “payment method is missing”

my Payeezy is throwing an error “payment method is missing”
im testing authorize transaction which i believe doesnt require payment method.
here’s my code
http://pastebin.com/gEyAfyuf
here’s the response on our site at http://wolcottschoolpay.com/test/payeezy_php/test.php
{
correlation_id: "228.1440254919101",
Error:
{
messages:
[
{
code: "payment_method_missing",
description: "The payment method is missing"
},
{
code: "missing_amount",
description: "The amount is missing"
},
{
code: "missing_currency",
description: "The currency is missing"
}
]
},
transaction_status: "Not Processed",
validation_status: "failed",
transaction_type: "authorize",
currency: "USD”
}
I copied most of the part here on the official payeezy php direct library on github.
authorize transaction is on line 127
https://github.com/payeezy/payeezy_direct_API/blob/master/payeezy_php/example/tests/PayeezyTest.php
i also tried both my merchant test details and the one provided at payeezy library but none worked.
Is this a library issue? any idea?
First you need to add x_currency_code and x_amount in api request. without amount and currency it can not process transaction.
And to process payment you need to select payment method like VISA, AMERICAN EXPRESS, DISCOER etc...
As the error message suggests, your request JSON payload is missing amount, currency and payment method. Please add those and try again.

Moving Adaptive Payments App from sandbox to live - Transaction is Invalid

I'm moving an app from sandbox to live. I've changed to my live api user, api signature, api password and appid.
In addition I modified the api url and paypal url as follows.
`//public $apiUrl = 'https://svcs. sandbox.paypal.com/AdaptivePayments/';`
`//public $paypalUrl = "https://www. sandbox.paypal.com/webscr?cmd=_ap-payment&paykey="; `
`public $apiUrl = 'https://svcs. paypal.com/AdaptivePayments/'; `
`public $paypalUrl = "https://www. paypal.com/webscr?cmd=_ap-payment&paykey=";`
I'm landing on payal at
"url https://www .paypal.com/webscr?cmd=_ap-payment&paykey="
with no paykey populated.
I'm getting a message on the paypal page that says "This transaction is invalid. Please return to the recipient's website and try again."
What am I doing wrong?
Thanks a trillion in advance for your help.

authorize.net sandbox testing giving error

I am integrating authorize.net in PHP. I have used http://developer.authorize.net/integration/fifteenminutes/#custom this sdk for my development.
For testing, I have created an sandbox account. When I am executing the code - I'm getting below error:-
AuthorizeNet Error: Response Code: 3
Response Subcode: 1
Response Reason Code: 87
Response Reason Text: (TESTMODE) Transactions of this market type cannot be processed on this system.
How will I recover this issue and will make an successful test?
I have also checked payment processing using authorize.net. But not helped me so much.
Any help is appreciated.
EDIT:- code is below
function authorizeNet($options)
{
require_once '../anet_php_sdk/AuthorizeNet.php'; // Make sure this path is correct.
$transaction = new AuthorizeNetAIM('YOUR_API_LOGIN_ID', 'YOUR_TRANSACTION_KEY');
$transaction->amount = $options["gift_amt"];
$transaction->card_num = $options["card_no"];
$transaction->exp_date = $options["card_expiry"];
$response = $transaction->authorizeAndCapture();
if ($response->approved) {
echo "<h1>Success! The test credit card has been charged!</h1>";
echo "Transaction ID: " . $response->transaction_id;
die();
} else {
echo $response->error_message;
die();
}
}
in the place of YOUR_API_LOGIN_ID and YOUR_TRANSACTION_KEY - I placed correct information. Here I don't want to disclose so I haven't mentioned it here.
This error indicates that the account that you are using was created for Card Present (retail) transactions, but you are trying to integrate to our Card Not Present (e-commerce) APIs or vice versa. The only way to resolve this is to open a new sandbox account with the correct market type.

Categories