Sagepay API - Simulate rejected payments? - opayo

I'm testing an app which accepts payments through Sagepay.
It all seems to be working OK but I would like to test various types of non-successful responses in the Sagepay sandbox.
For example, each test I have done so far has returned a status of OK. It is also possible to receive statuses like REJECTED, NOTAUTHED, INVALID etc
Is it possible to simulate these responses in some way?
Entering incorrect details repeatedly just returns me to the failure URL I specify in the API settings.

If you login to your simulator account on Sagepay via https://test.sagepay.com/simulator/ you can tell it which responses to return. You can instruct it to return random responses, or MALFORMED, INVALID, ERROR, NOTAUTHED, REJECTED, 3DAUTH.
Unfortunately you have to change these through the admin panel and then they apply for each transaction rather than using different details to trigger different responses.

In addition to Steve's answer, if you use the SERVER integration you can click different buttons to SIMUALATE (on the SIMULATOR server) a reply from SagePay gateway.

Related

Clickatell - API access to billing log?

I need to be able to access a log of all SMS that were sent. Is there a way to do this via their HTTP API? I haven't had much luck finding anything that reference this in their docs.
There is a feature called 'callbacks' that can send an HTTP request to your server for every message you send. It will give you status updates about the message and the message charge. This allows you to build up whatever form of custom reporting that you may want.
https://www.clickatell.com/developers/api-docs/callback-(push-status-and-cost-notification)-advanced-message-send/
You send your message with the callback parameter... And you specify your URL to receive callbacks on your API connection on the website.
Unfortunately, you can't access reporting features like that via API. You need to log in to your central dashboard to get that information.
You can, however, query the message status if you have the message ID, but I don't think that's quite what you're looking for.
(Disclosure: I work for Clickatell)

AuthorizeNet Omnipay Error

I am using omnipay package for my payment method in authorized.
I have two site on the same server, one is a live site that runs ssl and one that is for testing purposes only and do not run ssl.
Now, i dont have problem on paying in our testing site which it runs within our expectation. But, it seems odd in our live site because after entering my billing information, it returns an error that says:
An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.
This transaction has been approved.
It is advisable for you to contact the merchant to verify that you will receive the product or service.
Where do u think the problem lies? I really need help on this. Thanks!
This means the relay response URL used by your application is not returning a successful response to Authorize.Net in time (5 seconds). As a result Authorize.Net is assuming the page is not functioning and displaying that message.
You either need to verify the URL is correct, not error-ing out, and responding within a few seconds.

Using parse.com to receive Trello webhooks

1. Goal
I want to use parse.com to receive Trello webhook.
1a. Why?: Because I want to monitor my trello model and receive say a push notification on my android device and do neat things from the push notficiation (I'm an Android Dev)
2. What I've tried
2a. Setup on parse.com
I've created an app on parse.com
Obtained the keys (REST keys for the REST api)
Checked the above endpoint with Postman, works perfectly.
2b. Setup on trello.com
I've obtained an api appkey and secret; with full write on all boards, never expires
Tested the above with Postman, works perfectly fine.
PROBLEM: Posted to the following using Postman (of course with proper details for key, token, model, etc.
Request=
$.post("https://trello.com/1/tokens/[USER_TOKEN]/webhooks/?key=[APPLICATION_KEY]", {
description: "My first webhook",
callbackURL: "https://api.parse.com/1/functions/webhookReceiverTrello",
idModel: "4d5ea62fd76aa1136000000c",
});
Response Try=
URL (https://api.parse.com/1/functions/webhookReceiverTrello) did not return 200 status code, got 401
3. What is the problem?
Parse.com expects auth keys, etc as header. AFAIK Trello can NOT DO that.
How do I get a trello webhook to call a parse.com cloud function ?
Use a proxy (a simple web app will do)
This is how I did it:
Receive the webhook on a simple web app and make the necessary post call to parse.com
I used heroku for hosting
I used MeteorJS for the web app
Note: An issue you could encounter:
Trello.com sends calls to webhooks in proper order i.e. a card was created, the same card was updated, etc.
When you receive the webhook and make (proper) post calls, they will be received out of order at parse.com i.e. a card was updated and then it was created. This is just due to the way internet works, if you need an explanation, it's another SO question. ;)
This took me a while to figure out; mentioning so that you don't also spend your time with this.
A Fix: I don't know a simple/efficient way to fix this. Please let me know if you do. One possible solution is to queue all POST calls i.e. make POST call 1 and when a successful callback is gotten do the next one. Trello.com seems to do this in a more quicker fashion, it doesn't seem like they wait for a callback given how quick successive calls are received.

Sagepay: Payment Authorised and Then Failed

I'm using Server/InFrame integration, and according to Sagepay support, there are (rare) occasions when we get a notification about a successful payment (via an OK status), but this is then later failed. This can happen, according to Sagepay support, when they haven't been able to contact the bank properly.
I'm unable to find details about this in the documentation at http://www.sagepay.co.uk/file/1161/download-document/SERVERProtocolandIntegrationGuidelinesV3%200.pdf?token=0eZCcKj0tm33YeZ4gfrk4pHPaLClQnRcq3_vXsISjHI . The closest thing I see is in Step 12,
when SagePay sends batch files to the bank
If transactions are rejected, we correct any errors and resubmit them for you.
What happens, in terms of status codes sent to the notification url, in a case when this batch fails, or there is some other error after the "OK" is sent to the notification url? Is there any official documentation to handle this case, or similar cases when a payment is "OK", but then later fails?
Edit: I'm seeing that the simulator doesn't seem to handle this case either. Is there a way to properly test/simulate this case, when OK is sent, but then later failed?
The only reason you would receive a mixed message, such as Error/Failed on My Sage Pay but OK via Notification URL, is if an error occured during the notiication which returned an error/invalid response.
If the notification response via the Notification URL is interrupted i.e. browser refresh/closed etc Sage Pay may pick this up as error after the authorisation from the bank has been received as OK. We will then send Error via Notification URL to confirm the transaction has failed.
We'll send the notification several times until we receive a successful response/handshake from you in which you confirm the Status, StatusDetail and RedirectURL.
This scenario does not occur often however if you are able to provide a TXID example, our contact details can be found via http://www.sagepay.co.uk/contact, within 72 hours of the transaction being posted, we can investigate the reason for failure against the transaction logs.
Sage Pay Support

Why is Authorize.net throwing an error when my relay response URL points to a CodeIgniter controller and not otherwise?

I'm not typically a web developer, but I'm a decent enough coder that I felt comfortable accepting a proposal from a friend to develop his brother's small business website. I'm nearly finished and I've been using CodeIgniter, which has been a huge help and was easy to jump into.
They have a handful of products they'd like available for purchase via the site, their preference was Auth.net (which I have no previous experience with), and their host does not support SSL (nearlyfreespeech.net), so I decided that Auth.net's SIM was appropriate. If I test SIM outside of the CI application with a relay response page which simply spits out the available transaction details, everything goes as expected. If I try it with the relay response page set to a CI controller/method which simply echoes a string, Auth.net displays the following 'error':
An error occurred while trying to
report this transaction to the
merchant. An e-mail has been sent to
the merchant informing them of the
error. The following is the result of
the attempt to charge your credit
card.
This transaction has been approved.
It is advisable for you to contact the
merchant to verify that you will
receive the product or service.
My initial thought was that perhaps the rewrite rule I set up to circumvent having to include the index.php front controller was the issue, so I tried including it in the relay response URL with no change. I should also note that the controller in question implements a _remap() method, but the relay response method shouldn't be affected by it as it doesn't match it's regex.
Any insight(s) would be greatly appreciated.
This error occurs when your script doesn't respond within a specified amount of time. It also is displayed if anything other then a 200 success message is returned. So basically there is an error in your relay response URL.
You need to test this first by pulling up the page directly to see if it works and returns the proper header response. Then you can test it by sending a simulated POST response to it and see if it also responds properly. If those work make sure the script isn't taking too long to respond. If it is there probably are ways to optimize the slow page to give the response in the appropriate amount.

Resources