sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

live account accepting test card

Open monukanyal opened this issue 9 years ago • 3 comments

i am using live merchant account credential and i have changed this $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); to
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION);

but still it is accept test card number like (4111111111111111). please guide me!!

monukanyal avatar Jun 19 '17 06:06 monukanyal

Hi @monukanyal, The SDK doesn't do any validation that would reject the card number. It's still a properly formatted number, so it would make it through the SDK just fine. The actual authorization of the number is done once the transaction is sent to the web service, and in a production scenario you'll get a response showing that that card is declined.

In the response to the transaction, there will be a response for the API request (which should show success any time that the data was successfully acted upon by the API), and transaction response which details how the customer's issuing bank responded to the transaction (which could be approved or declined or some other things).

What's the full response that you're getting (either from the phplog file or the full $response object)?

adavidw avatar Jun 19 '17 16:06 adavidw

I have used test card(4111 1111 1111 1111) for Automated Recurring Billing. i got subscription id in response. Complete response is: net\authorize\api\contract\v1\ARBCreateSubscriptionResponse Object ( [subscriptionId:net\authorize\api\contract\v1\ARBCreateSubscriptionResponse:private] => 34224553 [profile:net\authorize\api\contract\v1\ARBCreateSubscriptionResponse:private] => net\authorize\api\contract\v1\CustomerProfileIdType Object ( [customerProfileId:net\authorize\api\contract\v1\CustomerProfileIdType:private] => 1509127893 [customerPaymentProfileId:net\authorize\api\contract\v1\CustomerProfileIdType:private] => 1509753756 [customerAddressId:net\authorize\api\contract\v1\CustomerProfileIdType:private] => ) [refId:net\authorize\api\contract\v1\ANetApiResponseType:private] => ref1497931991 [messages:net\authorize\api\contract\v1\ANetApiResponseType:private] => net\authorize\api\contract\v1\MessagesType Object ( [resultCode:net\authorize\api\contract\v1\MessagesType:private] => Ok [message:net\authorize\api\contract\v1\MessagesType:private] => Array ( [0] => net\authorize\api\contract\v1\MessagesType\MessageAType Object ( [code:net\authorize\api\contract\v1\MessagesType\MessageAType:private] => I00001 [text:net\authorize\api\contract\v1\MessagesType\MessageAType:private] => Successful. ) ) ) [sessionToken:net\authorize\api\contract\v1\ANetApiResponseType:private] => )

monukanyal avatar Jun 20 '17 04:06 monukanyal

I see. This makes sense. You've created a subscription, but creating the subscription doesn't actually charge anything to it until the subscription's start date. Rest assured that once you reach the first charge on the subscription, the transaction would correctly decline.

If you want to verify that the card is good before setting up the subscription, you have a few options. You can charge the customer the initial amount of the first installment of the subscription up front and then proceed to set up the whole subscription if the charge is good. Or, if you intend to allow some sort of trial access but still want to know if the card is at least chargeable right now, you could try making a customer profile with the card (as seen in sample code here: https://github.com/AuthorizeNet/sample-code-php/blob/master/CustomerProfiles/create-customer-profile.php) followed by a request to "validate" the profile (as seen in sample code here: https://github.com/AuthorizeNet/sample-code-php/blob/master/CustomerProfiles/validate-customer-payment-profile.php, but making sure to validationMode to "liveMode" to do an actual authorization of the card). You can combine these steps by adding validationMode to the create customer profile request and setting it to liveMode, like this:

$paymentprofile->setValidationMode(liveMode);

Then, if the verification is successful, follow that up with ARBCreateSubscriptionRequest, specifying the customer profile to charge instead of the payment info (as seen in the sample here: https://github.com/AuthorizeNet/sample-code-php/blob/master/RecurringBilling/create-subscription-from-customer-profile.php).

adavidw avatar Jun 20 '17 04:06 adavidw