X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   X-Payments issues & questions (https://forum.x-cart.com/forumdisplay.php?f=50)
-   -   X-Payments API Recharge with Cart questions (https://forum.x-cart.com/showthread.php?t=75352)

joestern 05-16-2017 02:34 PM

X-Payments API Recharge with Cart questions
 
I'm trying to use the API for X-Payments to recharge and to create an order in the process.

So far, I have gotten the recharge to work, and I get a bare order created. It has the customer info and lists in the customer portal, but I cannot get any line items to show there. The total, however, is correct.

But I'd like to have more info in there in case a customer logs in and wants to verify their charge history.

I'm using:

Code:

<items type="cell">
        <sku>misc-charge</sku>
        <name>Miscellaneous Charge</name>
        <price>75.33</price>
        <quantity>1</quantity>
    </items>


I have a product in my X-Cart with the SKU of 'misc-charge' and no set price.

I also can't get the tax to breakout.

There isn't a lot of documentation about the API so I can't really figure out what more to try.

I did finally figure out that the mechanism to tell the cart about the new order (since you are communicating with X-Payments and not X-Cart) is this line:

Code:

<callbackUrl>https://www.example.com/xcart/payment/cc_xpc.php</callbackUrl>

That doesn't exactly seem like a "callback" URL to me, but that's the way X-Payments pings your cart with the info about the new order.

joss 05-17-2017 11:37 PM

Re: X-Payments API Recharge with Cart questions
 
Please refer to this article for the detailed description of the recharge requests:

https://www.x-payments.com/help/X-Payments:Charge_again_transaction_request_(Tokeniz ation)

You can send the information about items, shipping cost, etc in the "cart" block.

The callback request contains the information about payment, however since recharge is a direct POST request, you can use the response for that request to get the result of the transaction. It contains the payment status and information about any errors occurred.

Meanwhile, to process the callbacks you should create your script which should be accessible via internet and pass its URL. Note: information in callback request to your script is encrypted. Please refer to these articles for the detailed information:

https://www.x-payments.com/help/X-Payments:Callback_request_with_service_payment_inf ormation
https://www.x-payments.com/help/X-Payments:Detailed_payment_and_transaction_informat ion_request#Response_specification

The PHP implementation of the encryption/decryption can be found here: https://drive.google.com/drive/folders/0B6p7sehSZL8_R3dHUk1sQVYteUE

joestern 05-18-2017 09:36 AM

Re: X-Payments API Recharge with Cart questions
 
Thanks.

Still working through the info, but your first and third links are broken - first needs a ")" and third had : D converted into "grin."

joestern 05-18-2017 09:54 AM

Re: X-Payments API Recharge with Cart questions
 
To break this down into pieces - here's my first chunk.

I believe that if the customer has an account in X-Cart, the X-Payments recharge request only needs this identifying information to successfully link a new order to that customer:

Code:

<cart>
    <login>customer</login>
    <billingAddress>
    <email>person@domain.com</email>
  </billingAddress>
...
</cart>


joestern 05-18-2017 02:31 PM

Re: X-Payments API Recharge with Cart questions
 
I'm pretty sure there's a bug in this API, or in X-Payments.

I still cannot get much of the info I post from X-Payments over to X-Cart. All I get in X-Cart is a very minimal order with a total. The order is tied to the customer who made the original charge in X-Payments (the reference transaction), but there are several issues:

-No matter what address I post with the recharge XML to X-Payments, X-Cart makes the order with the default billing and shipping information from the customer's profile. So X-Cart uses the defaults in the customer's address book. X-Payments uses the information posted. I have tried this a few different ways and found this to be the pattern. I have not yet tried with a customer who doesn't have a profile.

-If I change the email address in the recharge request, it has no effect. Essentially, this information is discarded completely.

-No items in the <cart> area carry over to X-Cart or are shown in X-Payments (I don't think they could possibly be shown in X-Payments). Essentially, the cart information is also discarded.

-Same for tax and shipping costs - the information is discarded.

It feels like the only information that X-Payments successfully communicates to X-Cart is the customer and the total. All other info is lost somewhere in the process.

joestern 05-23-2017 08:06 AM

Re: X-Payments API Recharge with Cart questions
 
I'm still working on this problem. With your example code (just changing the data fields) I cannot get a cart to show up in the X-Cart side. I've made many, many changes to the post code, and still, no progress.

Can someone at X-Cart just try the sample code on your side just to confirm that this works for you?

If it works for you, I'll keep working. But I really think there may be an issue in the code somewhere.

Thanks,

Joe

ambal 05-24-2017 02:28 AM

Re: X-Payments API Recharge with Cart questions
 
Hi Joe,

I am really sorry we can't get back to you here. Right now we are busy with preparing our connectors for new X-Cart versions which are going to be released very soon.


All times are GMT -8. The time now is 04:41 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.