Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Payum custom gateway

Tags:

php

symfony

payum

I want to use a new gateway with payum but I have confused.

I have a flowchart of a transaction, in a regular way I know how to implement it but I don't know how to implement it in payum way. enter image description here

What I want is, that somebody tells me that :

  • how many Payum action I need ?
  • how many controller action I need ?
  • Do I need a new gatewayFoctory or a new gateway or both ?
  • what is different between afterUrl and taregtUrl ?
  • In Docs,we have an object named "model" !, what's the purpose of it?
like image 229
Saman Mohamadi Avatar asked Jun 19 '16 13:06

Saman Mohamadi


1 Answers

At Payum getting started it looks like all you actually need is 3 steps/actions:

prepare

  • Set values
  • Ask for and fetch target token from payum
  • Redirect (url to redirect to is returned within the token.)
  • The redirect url is a payum url
  • Payum will preprocess payment stuff
  • Payum will redirect to your capture method

capture

  • Actually tell payum to process the request (authentication yourself with the token)
  • Burn token
  • Redirect to done method (actually redirecting to Payum and Payum is redirecting to your done method)

done

  • Check if it went sucessfully
  • Do stuff

Other Stuff

  • getTargetUrl is the URL returned by payum, where you redirect to after prepare
  • getAfterUrl() is the URL returned by payum, where you redirect to after capture
  • Examples of other gateways can be found here if you want to integrate them you define a new gateway (see config file for KlarnaCheckout e.g.)
  • If you want to add another payment provider you start here using composer you build a new gatewayFactory (and afterwards define the gateway like above)
like image 137
Hafenkranich Avatar answered Nov 13 '22 18:11

Hafenkranich