Search code examples
paypalpayum

PayumBundle Paypal Express confirmation step


Is it possible to perform a custom action, such as checking a date, in payment confirm? I want that just after click the confirmation button do a query to database and depending on result confirm the payment to paypal or not.


Solution

  • Yes, it is possible. you have to overwrite the confirm order action.

    You can pass your own to the factory.

    <?php
    $factory->create([
        'payum.action.api.confirm_order' => new AcmeConfirmOrderAction(), 
    ]);
    

    If you are using symfony, register the action as service and add the tag:

    acme_configrm_order_action:
       class: AcmeConfirmOrderAction
       tags:
           - { name: payum.action, alias: payum.action.api.confirm_order, factory: paypal_express_checkout_nvp }
    

    I've not tested the code but it should be something like this. You can test it works with console command: app/console payum:gateway:debug