Community hosted payment gateway


#21

Yeah I’m having trouble explaining what I mean.

Basically, payment gateways are supposed to fire off a ‘notification’ to the merchant when payment completes or expires - merchants don’t typically keep running API calls to check status of payments.

This is called IPN (Instant Payment Notification). So for example the merchant has an API endpoint that receives a payload from the gateway that tells them a few different things like: status, amount paid, custom field, secret.

This process is called pingback - cause it ‘pings back’ the merchant on completion or expiration. Does that make sense?

I believe you are confusing ‘Pingback’ with ‘ReturnURL’. They are different things. ReturnURL redirects the person after error/complete.

Pingback is the URL to the merchants API endpoint that waits for the status information to be ‘pinged back’ to it.


#22

Thanks @cryptorex for the explications about IPN pingback (in discord, the other night).

I updated all the staff by adding the secret key generated by the gateway, and the return of it in the JSON by the request_payment/ call. I also append it to the IPN pingback URL as following (paid and expired):

https://yourDomaine.com/yourPath/?and=yourParam&secret=01234abcd&state=5
or
https://yourDomaine.com/yourScript.php?secret=01234abcd&state=2

I also updated the web site with the new informations, could you please have a look in the API description if it’s understandable: https://pay.btcz.app/

I took this opportunity to make some parameters optional (like the secret, it can be specified, but if not, it will be generated by the gateway).

List of updates (v0.1.3)

  • Added secret phrase return in JSON by request_payment/ call.
  • Added invoice state and secret param in IPN pingback.
  • added IPN pingback by expired state=2.
  • Manage optional parameters by query string (?) instead of router path (/).
  • Solved double url encoding issue.
  • Rewrite of some code parts.
  • Updated Web UI API explication with examples.
  • Added website icon.

#23

@Marcelus great work once again!

I’ve tested ipn pingback and it works perfectly as expected!

API instructions only few things I found that could be misleading but is very minor:

  1. The param in the API route example shows sellerAddress but it should be only ‘seller’.

  2. Do we still have to urlencode two times? I’m still doing it twice and I think its still required but you removed that NOTE that says we need to urlencode twice. If we don’t then I need to re-test.

  3. This is just cosmetic but I think there is a character error ‘currency’ doesn’t show in the example right here:

I’ve moved one of my clients sites to testing the gateway in a live environment - I think its ready to start live testing so I"m doing that now. It seems to be working great.


#24

Every day, we learn somthing new :slight_smile:

&curren is " ¤ " in html code. I hade to change it to &amp;currency between the <pre> tag.

About the simple or double URL encoding, I was to happy to see that it’s solving it self.
:sweat_smile: But only at half…

  • By using the query string (?expected, &currency…) a simple URL encoding work.
  • By using the full route path (/:expected/:currency/…) a double URL encoding is needed.

(I have no idee wy!?)

I also updated as well the API route and notes info.

:point_right: Also great for testing ! :muscle: I will update the WP-woocommerce plugin, and soon it’s done, I also move an WordPress test site to live too.

@everyone who owns or experiences with a website, you could do the same.
I will gladly support you regarding the use and integration (Discord or here) of the gateway in your site. In addition, all actions (gateway creation, cancellation, payment, pingback, …) are logged in order to be able to analize them when necessary.


#25

Just a small update (v0.1.3 beta):

  • Added a Cubecart payment plugin (check topic here).
  • Added postMessage(Callback URL) in invoice.html for cross-domain data transfer (iFrame->window.top).

The postMessage(Callback URL) can be listened by the top window by someting like:

window.addEventListener('message', function(event) {
    if (~event.origin.indexOf('pay.btcz.app')) {
        setTimeout(function() {
          window.top.location.href = event.data;
        }, 3000);
    }
});

The next version will be a stable production gateway. I have first to build a new test&dev environment. It will be by mid-end November.