I am writting code in python 2.7 using the SDK from the github repo to validate the information given by the user before giving them access to my websites paid content. The user is to enter their card number and expiration date.
I take this information and create a subscription with it. Once the subscription is created I attempt to validate the payment information via the payment profile. When I do this in my sandbox environment (in live mode) I simply get an "E00040 Customer Profile ID or Customer Payment Profile ID not found" message.
When I look for these ids myself I find that they do exist and are connected with eachother properly. Here are the python functions being used to validate the payment information.
def get_subscription_from_id(self, subscription_id): getSubscription = apicontractsv1.ARBGetSubscriptionRequest() getSubscription.merchantAuthentication = self.merchant_auth getSubscription.subscriptionId = str(subscription_id) getSubscriptionController =\ ARBGetSubscriptionController(getSubscription) getSubscriptionController.execute() response = getSubscriptionController.getresponse() if(response.messages.resultCode == "Ok"): return response.subscription else: raise Exception("Subscription id is invalid or could not be found") def validate_payment_profile(self, profile_id, payment_profile_id): print("DEBUG::: profile: " + str(profile_id)) print("DEBUG::: payment: " + str(payment_profile_id)) validate_customer_payment_profile =\ apicontractsv1.validateCustomerPaymentProfileRequest() validate_customer_payment_profile.merchantAuthentication =\ self.merchant_auth validate_customer_payment_profile.customerProfileId = str(profile_id) validate_customer_payment_profile.customerPaymentProfileId =\ str(payment_profile_id) validate_customer_payment_profile.validationMode = "liveMode" validate_customer_payment_profile_controller =\ validateCustomerPaymentProfileController( validate_customer_payment_profile) validate_customer_payment_profile_controller.execute() response = validate_customer_payment_profile_controller.getresponse() if(response.messages.resultCode == "Ok"): return True else: print("DEBUG::: " + response.messages.message['code']) print("DEBUG::: " + response.messages.message['text']) return False
Any ideas of what could be the problem for validating this information?
P.S. the merchant_auth object is define globally and used in all other method which do work properly. If needed I can post its definition as well.
Solved! Go to Solution.
I added a 5 seconds delay between creating the subscription and verifying the information and I am still getting the E00040 error. However I get an E00027 error if I delay 15 seconds. This does seem like it is a bit too long for me to have to wait. Also I do not see why I would get the 27 error because the code for verifying the information is the same as provided in the github repo.
After doing this and looking around I found that you were right and I just needed to add a delay. The problem I mentioned in my previous reply was due to using liveMode instead of testMode for the validationMode. Is this the same value that I must use in a production setting?
I am experiencing this issue as well. It has been rather difficult to troubleshoot but I can confirm making the exact same API call to create a subscription from profile fails if called immediately, and succeeds if called a few moments later. What is strange is that this was working just fine when we launched our code in September, this problem only cropped up in late November.
Richard, you mention "some latency" is to be expected if calling CreateSubscription immediately after creating the customer/payment profile. Can you elaborate on this? It seems a bit "kludgey" to introduce a random delay/wait in my code in hopes of waiting out such a delay.
What is causing this latency? Is this something that will be resolved?
Is there a better workaround than simply introducing a random wait of several seconds into the code?
I appreciate any insight you can provide.
Are you experiencing the delay in production or sandbox? Is it consistent or intermittent when you experience a delay. Are you using our API or and SDK? If API, which endpoint are you connecting to?
Thanks for the follow up, especially on a holiday weekend. I am experiencing the delay in production and, yes, it has been consistent since approximately late November. Had not seen it before that. I've poured over the code to try to determine if anything has changed, but cannot identify anything.
The most telling evidence is that I log the request sent to the createSubscriptionFromCustomerProfile call (which is using the SDK) and the exact same request args produce different responses. When run in real-time as part of checkout, the error is generated. When I test it subsequently with the exact same call using the same customer/payment profile ID's, args etc., it succeeds.
Let me know if I can provide further details, submit code off-line to you, etc.
Because this is for a production account, I would suggest opening an eTicket and provide all of the information below:
Your Gateway Login ID
Approximate start date of issue
A summary of the issue (using what you've provided in community so far should help)
It may help to refer to this thread in your ticket
Provide details on the language SDK, version, platform, etc for background
Indicate that you've engaged with developer support first and they referred you to customer support
Ask for escalation of your ticket to a support specialist
Once you've created the ticket, use the contact us form with the ticket number, a link to this thread and they can escalate as well.
It may take a few days to get a response, especially since this is a holiday weekend and Monday is a holiday.
Have a happy and safe new year.
I ended up going with your earlier suggesting and re-writing the code to use the CreateSubscription call and create the customer/payment profiles and subscription all at once. Works fine now. But I will still open the ticket as the other method *should* work too.