I have created a test account with Authorize.net. My development environment is rails 3 and I am trying to implement the Server Integration Method (SIM) by using static IP. But I am getting an error:
"3,1,87,(TESTMODE) Transactions of this market type cannot be processed on this system.,000000,P,0,,,199.00,,auth_capture,,,,,,,,,,,,,,,,,,,,,,,,,,D3EA25CA1DF97765286A48C6B22287F4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,✓,uSIUUgX0d++dIheYjcHdlztlViD/r4YDUP9rEuEy9U8=,Purchase" when send request to "AuthorizeNet::SIM::Transaction::Gateway::TEST" gateway.
I also found this link: others got similar type error
But not helpful. Any suggestions how to resolve this error? I wrote following codes in the action.
#amount = 10.00
#sim_transaction = AuthorizeNet::SIM::Transaction.new('API Login ID', 'Transaction Key', #amount, :hosted_payment_form => true)
#sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))
Since you are dealing with credit card transactions through web applications, you need to make sure your Sandbox account is of "Card Not Present" type. If you don't remember which type you set it to, it is a good idea to create a new account and make sure to select "Card Not Present" option. Otherwise, you will get this error message.
I hope this helps.
Related
I have implemented Braintree subscription payment in rails app. Everything works fine in development, however when I switched to production (I have registered with Braintree and got a real account, and I change all the key in environment)
I have tried to submit an invalid card information to test the app, the page keeps showing error.
I look at the application logs and it said
NoMethodError (undefined method `customer' for #<Braintree::ErrorResult:0x007f6ed80f1d80>):
Here's my create method, I follow your tutorial and it works fine in development
def create
if current_user.braintree_id?
customer = Braintree::Customer.find(current_user.braintree_id)
else
result = Braintree::Customer.create(
email: current_user.company_email,
company: current_user.company_name,
payment_method_nonce: params[:payment_method_nonce]
)
customer = result.customer
current_user.update(braintree_id: customer.id)
end
result = Braintree::Subscription.create(
payment_method_token: customer.payment_methods.find{ |pm| pm.default? }.token,
plan_id: params[:plan_id]
)
if result.success?
result.subscription.transactions.each do |transaction|
current_user.transactions.create(braintree_transaction_id: transaction.id,
plan_name: params[:plan_name],
price: transaction.amount.to_f,
start_date: transaction.subscription_details.billing_period_start_date,
end_date: transaction.subscription_details.billing_period_end_date,
subscription_id: result.subscription.id
)
end
current_user.update(braintree_subscription_id: result.subscription.id,
next_billing_date: result.subscription.next_billing_date,
billing_period_start_date: result.subscription.billing_period_start_date,
billing_period_end_date: result.subscription.billing_period_end_date,
status: result.subscription.status,
next_billing_period_amount: result.subscription.next_billing_period_amount,
paid_through_date: result.subscription.paid_through_date,
plan_id: params[:plan_id],
plan_name: params[:plan_name])
flash[:info] = "You've been subscribed successfully"
redirect_to #current_user
else
flash[:warning] = "Invalid card information"
render 'new'
end
end
The weird thing is it doesn't render the flash warning of unsuccessful result and redirect to the original new_subscription_path, instead the website url redirect to this
https://herokuappname.herokuapp.com/subscription.1
and the page error shows
This page isn’t working herokuappname.herokuapp.com is currently unable to handle this request.
HTTP ERROR 500
So, I want to know whether it is the customer method error (which I don't think so because it doesn't have any problem in development mode) or any other problem such as why the page url so weird?
I looked at the Braintree control panel, and the reason that the subscription failed was because the bank declined the transactions due to incorrect card information, which I entered incorrect card in order to test it, if it is invalid card info, why didn't it display the flash notice and redirect back to the new_subscription_path, instead it redirects to the subscription.1 url which I have mentioned above?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
I'm not sure if you used the same invalid card number for testing in production as in sandbox, but I'll try to answer your questions with the information we have on hand:
NoMethodError (undefined method `customer' for #):
By attempting to create a customer with a payment method with an invalid card, the result of that API call was an ErrorResult object. ErrorResult objects are either a validation error, processor decline, gateway rejection, or other exception messages, and do not contain a customer method. Hence, the undefined method error.
You should add some error handling around all of your Braintree API calls so that you can address any errors throughout the subscription process.
Feb 8, 2018
My Ruby on Rails application has been successfully using ActiveMerchant::Billing::AuthorizeNetCimGateway with the payment type :credit_card for creating a customer profile with an embedded payment profile.
I'm now in the process of migrating to Authorize.Net's Accept.js which accepts credit card info directly sent from their hosted payment form and returns a payment nounce of type COMMON.ACCEPT.INAPP.PAYMENT that can be used for one time to create a payment transaction, customer profile, etc.
I constructed a payment_profile hash with :opaque_data in place of :credit_card. For example:
> payment_profile
=> {:payment=>
{:opaque_data=>
{:data_descriptor=>"COMMON.ACCEPT.INAPP.PAYMENT",
:data_value=> "eyJjb2RlIjoiNTBfMl8wNjAwMDUzNjBDMzAwOUQ3OEUzOUQ1MDk4QTYxMjFGNzlCQ0Y3RDRGQUE4NTNCMEU3MkYyMUJBNTI3NUE0NjQ2Q0ZFQTVFNzMxMDI2Qjg5ODJGNjBFRUE2RDZFMTZCMUY5NzQ4NUJFIiwidG9rZW4iOiI5NTE4MDc3Njg5NDA4MTAwOTAzNTAyIiwidiI6IjEuMSJ9"}},
:bill_to=>{:first_name=>"Firstname", :last_name=>"Lastname", :address=>nil, :city=>nil, :state=>nil, :zip=>nil, :country=>nil, :phone_number=>"(012) 234-5678"}}
I then tried to create a customer profile with an existing code similar to the following:
response = #gateway.create_customer_profile profile: {
email: client.email,
description: client.name,
merchant_customer_id: client.id,
payment_profiles: payment_profile
}
However, I received a response which had a result_code of Error and complained about "incomplete content" for element payment as follows:
> response
=> #<ActiveMerchant::Billing::Response:0x007f9827d14900
#authorization=nil,
#avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
#cvv_result={"code"=>nil, "message"=>nil},
#emv_authorization=nil,
#error_code="E00003",
#fraud_review=nil,
#message=
"The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.",
#params=
{"messages"=>
{"result_code"=>"Error",
"message"=>
{"code"=>"E00003",
"text"=>
"The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."}}},
#success=false,
#test=true>
I have a few questions in my mind:
Does ActiveMerchant::Billing::AuthorizeNetCimGateway even support Accept.js' :opaque_data in place of :credit_card?
If ActiveMerchant::Billing::AuthorizeNetCimGateway does support :opaque_data, what's may be wrong with the above payment_profile and what other content that I'd need to provide for payment element?
I'd appreciate any help in resolving this issue.
While this question is over 4 years old, and I'm assuming you have either found a solution or abandoned your effort, I ran into this same issue recently, and thought it would be helpful to add my findings in case someone else runs into this.
the AuthorizeNetCimGateway does not currently support Accept.js' opaqueData. In looking at the sourcecode for the active_merchant gem, specifically in /lib/active_merchant/billing/gateways/authorize_net_cim.rb, there is ultimately a method add_payment_profile that gets called. In that method, specifically on lines 759-761, you can see that the options are either a credit_card, bank_account, or drivers_license. A tokenized payment is not currently supported.
That being said, there is an open PR#2422 that adds support for this. At the time of writing this, it appears to be failing some rubocop specs, but hopefully it can get deployed in the near future!
I'm setting up payments using the Stripe API to allow a user to log into their Stripe account on an iPad and accept payments from anyone. To do this, I'm using Stripe Connect to log them in and save their account id, then I'm using the STPPaymentCardTextField to obtain credit card details, then using the Stripe iOS SDK I'm submitting a card (with the test card info - 4242...) and getting back a token via createTokenWithCard. This successfully returns a token. At this point I need to submit that token along with the destination account id (provided to the app after the user logged in) and other info (currency, amount, etc) to my own server to submit the payment to Stripe. I have verified that information is being submitted and forwarded onto Stripe, but Stripe is returning an error:
{ type: 'invalid_request_error',
app[web.1]: message: 'No such token: tok_13vxes2eZkKYli2C9bHY1YfX',
app[web.1]: param: 'source',
app[web.1]: statusCode: 400,
app[web.1]: requestId: 'req_7AIT8cEasnzEaq' },
app[web.1]: requestId: 'req_7AIT8cEasnzEaq',
app[web.1]: statusCode: 400 }
If we submit the credit card info directly, avoiding the token altogether, the payment succeeds. Something is wrong with this token, and we are not sure why it is failing. What could be going wrong here?
[[STPAPIClient sharedClient] createTokenWithCard:card completion:^(STPToken *token, NSError *error) {
//submit tokenId and other info to 'charge' endpoint below
}
NodeJS:
app.post('/charge', (req, res, next) => {
stripe.charges.create({
amount: req.body.amount,
currency: req.body.currency,
source: req.body.token,
description: req.body.description,
destination: req.body.destination
}, (err, charge) => {
if (err) return next(err)
res.json(charge)
})
})
Are you sure you're using the same API keys on your server and client?
Your server should be using your (live/test) secret key, and your iOS app should be using your (live/ test) publishable key as mentioned here on Stripe Testing.
I had been facing same issue for my test environment and the mistake i had been doing, i was adding the token received by Stripe like this one source: 'tok_18nnwSJ6tVEvTdcVs3dNIhGs' , but for the test environment we have to use source: 'tok_visa'.
Here is the list of test sources provided by Stripe. https://stripe.com/docs/testing#cards
It created customer for me, let me know if it helped anyone else as well.
The accepted answer does not work for me. I am using correct key for client and server, but still the issue is still there. I am sending source from iOS to the server as well, based on stripe example RocketRides, it is sending source ID of the credit card, which is "card_xxx", and that is not gonna work. You will have to add "customer" attribute for the call on your server side.
For example: (python)
stripe.Charge.create(amount=1000, currency='usd', source="card_xxxxx", **customer**='cus_xxxx', application_fee=600,destination={'account': 'acct_xxxx'})
Neither of the answers here worked for me.
I was trying to use Stripe's PHP library to charge a card that I already had on file like this...
$charge = \Stripe\Charge::create([
'amount' => 1000,
'currency' => 'gbp',
'card' => 'card_xxx',
'description' => 'Payment for Sam',
]);
And I was receiving the no such token error above.
To get it to work, I also had to provide the customer id like so...
$charge = \Stripe\Charge::create([
'amount' => 1000,
'currency' => 'gbp',
'customer' => 'cus_xxx',
'card' => 'card_xxx',
'description' => 'Payment for Sam',
]);
First check api keys wheather they are the same at front end and backend.
If you are using testing api keys then you have to pass source: 'tok_visa' instead of your card source token source: 'tok_kb3kb23k2bk32bk3b2'.
I put this into my terminal
uri = URI('https://api.madmimi.com/mailer/to_list')
res = Net::HTTP.post_form(uri,'username'=>'test#example.com',
'api_key' => 'xxxxxx2ce1ac9eb91c75f5933283eb6c ', 'promotion_name' =>
'bulletin', 'subject' => 'Your Daily Bulletin Update', 'from' =>
'noreply#matsu-namibiaflood.opensciencedatacloud.org/', 'list_name' => 'bulletin')
The result was
#<Net::HTTPBadRequest 400 Bad Request readbody=true>
On the Mad Mimi API they talk about putting in your user name and API key https://madmimi.com/developer/mailer/methods
What am I doing wrong? Should I put the username and API key elsewhere?
James here from Mad Mimi, would you mind popping an email to us and I can have a look at your account and check the settings, list names and the promotion.
I would say remove the / at the end of the your "from" email and just check there are no spaces in your API key.
If that doesn't work, I would need to check the promotion but make sure there are no {placeholder} in your bull
Thank you,
James
We are trying to integrate Google Wallet for digital goods with or php app and 2 days ago, on 15 November we've managed to get it working. However, when checking again the next day and even today, although the code remained the same, we didn't change a letter in it, it is still not working, giving us this error:
Uh oh. There was a problem.
We couldn't complete your purchase because of a technical issue.
Details of the problem below: Unfortunately, we could not confirm your purchase with the merchant's server. Your order has been canceled. Please contact the merchant if this problem continues.
The code we're using is this:
$response = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");
$response = substr_replace($response, "", 0, 4); //remove "
$response = JWT::decode($response, $sellerSecretKey);
header("HTTP/1.1 200 OK");
and like I said it worked fine two days ago and I have the feeling it's working now also, because in our log file we get printed this response
stdClass Object
(
[iss] => Google
[request] => stdClass Object
(
[name] => Product 1.
[description] => You are purchasing a total of 1 products from our Store. Thank you.
[price] => 9.99
[currencyCode] => USD
[sellerData] => client name,email address
)
[response] => stdClass Object
(
[orderId] => GWDG_S.c7a66f5b-4674-43f0-be16-2b72f69a7445
)
[typ] => google/payments/inapp/item/v1/postback/buy
[aud] => 03083876603093172875
[iat] => 1384689627
[exp] => 1384689647
)
The postback url is correctly specified and we are using sandbox to do the tests.
Is this a problem from Google? Are they working on the software or something and this is what's causing the problem? Or are we doing something wrong here?.
Any help would be much apreciated. Thank you.
Meant to comment but it won't fit...
That error points to something in your Postback handler. I just tried sandbox and things seem fine.
I'm not a php dev so this maybe inaccurate - are you responding to Postback with the orderId? Again, this is only based on my read of the code above (I think I only see http 200?)
The only other thing I can think of is that the lag for you to respond is more than 10 seconds(?) - which could explain why could be another reason you have logged data, but Google still cancelled it.
*Strike through text: you'd get data to log because Google will send you the data, it's whether or not you respond properly that matters
Once you decode the JWT with your Seller Secret, you can make sure that the cake purchase is OK and record it. Within 10 seconds of receiving the postback, your server must send a 200 OK response where the only content is the value of the "orderId" field. If it doesn't, Google cancels the transaction.
REF: https://developers.google.com/commerce/wallet/digital/docs/postback#responding
Hth.