Search code examples
symfonyomnipaypayum

Payum omnipay and Skrill


I'm trying to implement payment in my app using Payum 1.0, Payum Bundle 1.0 and Omnipay bridge with omnipay-skrill bundle as skrill is not supported out-of-the-box.

payum.yml

payum:
    security:
        token_storage:
            XXX\PaymentBundle\Entity\PaymentToken: { doctrine: orm }

    storages:
        XXX\PaymentBundle\Entity\Payment: { doctrine: orm }

    gateways:
        skrill:
            omnipay:
                type: Skrill
                options:
                  email: [email protected]
                  notifyUrl: /payment/skrill
                  testMode: true

This is my controller prepare action:

public function prepareAction()
{
    $paymentName = 'skrill';

    $storage = $this->get('payum')->getStorage('XXX\PaymentBundle\Entity\Payment');

    $payment = $storage->create();

    $payment->setNumber(uniqid($this->container->getParameter('shoppingCart')));
    $payment->setCurrencyCode('EUR');
    $payment->setTotalAmount($this->container->getParameter('price_of_xxx'));
    $payment->setDescription('desc');
    $payment->setClientId($this->getUser()->getId());
    $payment->setClientEmail($this->getUser()->getEmail());
    $payment->setLanguage('EN');

    $storage->update($payment);

    $captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
        $paymentName,
        $payment,
        'xxx_buy_premium_done' // the route to redirect after capture
    );

    return $this->redirect($captureToken->getTargetUrl());
}

So, when i visit the link associated with prepare action i get the Payum credit card form. But when i enter all data as response i get an error saying language parameter must be provided. I can't figure out why is it happening since i tried putting the language parameter in config file and setting payment language field. I suppose it has to be sent in form data as hidden field.

Is it possible to redirect user to https://pay.skrill.com/app/?sid= with parameters and get response from Skrill servers to captureDoneAction?


Solution

  • Try to set language to the details like this:

    $payment->setDetails(array(
            'language' => 'EN',
    ));