lib/AMNL/Mollie/Paysafecard/PaysafecardGateway.php
public function preparePayment($amount, $report_url, $return_url, $customer_ref, array $options = null)
    {
        // Check arguments
        if (!filter_var($amount, FILTER_VALIDATE_INT) || $amount < 100) {
            throw new \InvalidArgumentException('Amount should be in eurocents and at least 100 cents.');
        }
        if (!filter_var($report_url, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException('Report URL should be a valid URL.');
        }
        if (!filter_var($return_url, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException('Return URL should be a valid URL.');
        }
        if ($report_url == $return_url) {
            throw new \InvalidArgumentException('Report URL and Return URL should not be the same.');
        }
        if (preg_match('/[A-Z\s]/', $customer_ref) > 0) {
            throw new \InvalidArgumentException('Customer reference (description) may not contain any capital letters or whitespace.');
        }

        // Params
        $params = array(
            'partnerid' => $this->partnerId,
            'amount' => $amount,
            'customer_ref' => $customer_ref,
            'reporturl' => $report_url,
            'returnurl' => $return_url,
        );

        // Profile Key
        if ($this->profileKey != null) {
            $params['profile_key'] = $this->profileKey;
        }

        // Do request
        $response = $this->request('prepare/', $params);

        // Gather data
        if ($response->order === null) {
            throw new MollieException('Unexpected response');
        }
        $transactionId = (string) $response->order->transaction_id;
        $amount = (int) $response->order->amount;
        $destination = (string) $response->order->URL;

        // Return ProviderResponse
        return new ProviderResponse($transactionId, $amount, $destination);
    }
public function preparePayment($amount, $report_url, $return_url, $customer_ref, array $options = null)
    {
        // Check arguments
        if (!filter_var($amount, FILTER_VALIDATE_INT) || $amount < 100) {
            throw new \InvalidArgumentException('Amount should be in eurocents and at least 100 cents.');
        }
        if (!filter_var($report_url, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException('Report URL should be a valid URL.');
        }
        if (!filter_var($return_url, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException('Return URL should be a valid URL.');
        }
        if ($report_url == $return_url) {
            throw new \InvalidArgumentException('Report URL and Return URL should not be the same.');
        }
        if (preg_match('/[A-Z\s]/', $customer_ref) > 0) {
            throw new \InvalidArgumentException('Customer reference (description) may not contain any capital letters or whitespace.');
        }

        // Params
        $params = array(
            'partnerid' => $this->partnerId,
            'amount' => $amount,
            'customer_ref' => $customer_ref,
            'reporturl' => $report_url,
            'returnurl' => $return_url,
        );

        // Profile Key
        if ($this->profileKey != null) {
            $params['profile_key'] = $this->profileKey;
        }

        // Do request
        $response = $this->request('prepare/', $params);

        // Gather data
        if ($response->order === null) {
            throw new MollieException('Unexpected response');
        }
        $transactionId = (string) $response->order->transaction_id;
        $amount = (int) $response->order->amount;
        $destination = (string) $response->order->URL;

        // Return ProviderResponse
        return new ProviderResponse($transactionId, $amount, $destination);
    }
public function preparePayment ( $ amount , $ report_url , $ return_url , $ customer_ref , array $ options = null ) { // Check arguments if ( ! filter_var ( $ amount , FILTER_VALIDATE_INT ) || $ amount < 100 ) { throw new \ InvalidArgumentException ( 'Amount should be in eurocents and at least 100 cents.' ) ; } if ( ! filter_var ( $ report_url , FILTER_VALIDATE_URL ) ) { throw new \ InvalidArgumentException ( 'Report URL should be a valid URL.' ) ; } if ( ! filter_var ( $ return_url , FILTER_VALIDATE_URL ) ) { throw new \ InvalidArgumentException ( 'Return URL should be a valid URL.' ) ; } if ( $ report_url == $ return_url ) { throw new \ InvalidArgumentException ( 'Report URL and Return URL should not be the same.' ) ; } if ( preg_match ( '/[A-Z\s]/' , $ customer_ref ) > 0 ) { throw new \ InvalidArgumentException ( 'Customer reference (description) may not contain any capital letters or whitespace.' ) ; } // Params $ params = array ( 'partnerid' => $ this -> partnerId , 'amount' => $ amount , 'customer_ref' => $ customer_ref , 'reporturl' => $ report_url , 'returnurl' => $ return_url , ) ; // Profile Key if ( $ this -> profileKey != null ) { $ params [ 'profile_key' ] = $ this -> profileKey ; } // Do request $ response = $ this -> request ( 'prepare/' , $ params ) ; // Gather data if ( $ response -> order === null ) { throw new MollieException ( 'Unexpected response' ) ; } $ transactionId = ( string ) $ response -> order -> transaction_id ; $ amount = ( int ) $ response -> order -> amount ; $ destination = ( string ) $ response -> order -> URL ; // Return ProviderResponse return new ProviderResponse ( $ transactionId , $ amount , $ destination ) ; }
Request a new payment

@param int $amount Amount in eurocents
@param string $report_url URL to call when the state of the payment changes
@param string $return_url URL to user is send to after the payment process
@param string $customer_ref Unique customer reference
@param array $options NOT USED FOR PAYSAFECARD
@return \AMNL\Mollie\ProviderResponse
@throws \InvalidArgumentException
@throws MollieException
Request a new payment