Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When processing a payment, can I get back the Transaction ID, etc? #70

Closed
MLyons10 opened this issue Jan 26, 2015 · 5 comments
Closed
Assignees
Labels

Comments

@MLyons10
Copy link

I can't seem to find a way to do this anywhere, is anyone able to tell me how I might do this? I would like to log this for my records.

@jziaja
Copy link
Contributor

jziaja commented Jan 27, 2015

Hi @MLyons10, the transaction ID can be found via the related_resources property of each transaction associated with a payment.

Here's a code sample of how to get the transaction ID for a sale payment, along with how it looks using the sample project:

var payment = Payment.Get(apiContext, "PAY-89W644977H834061FKTDRCCY");
var transactionId = payment.transactions[0].related_resources[0].sale.id;

image

@jziaja jziaja self-assigned this Jan 27, 2015
@MLyons10
Copy link
Author

Thank you very much for your help. That works perfectly.

Am I able to get detailed information when an error is returned? I see that I get a 400 Error, but I was hoping to be able to get some detail as to what actually is the issue... I can't for the life of me figure out what is causing it to return an error...

Thanks for your help.

@jziaja
Copy link
Contributor

jziaja commented Jan 29, 2015

Yes, depending on where the 400 Error is encountered, a PaymentsException may be thrown and includes a Details property that provides quick access to the cause of the error. Otherwise, an HttpException will be thrown (which PaymentsException inherits off of), and includes a Response property that contains the response from the server.

An easy way to test this in the samples is to inject bogus data into an object and view the details of the exception that is thrown. In the run below, I changed the sample for making a PayPal payment so the transactions[0].amount.details.tax value was set to the letter 'a', thus resulting in a 400 error response and a PaymentsException being thrown by the SDK:
image

@jziaja
Copy link
Contributor

jziaja commented Jan 29, 2015

I should also mention that if you do get an error that you're having trouble understanding (some of the errors can be quite cryptic), sharing the debug_id contained in the error response with us here will allow our team to look up the specific details of what caused the error.

@jziaja
Copy link
Contributor

jziaja commented Feb 5, 2015

Closing this issue as the questions have been answered. Let me know if there's anything else you need help with. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants