Add payment method to request.

@param string[] $params
@param mixed    $payment
@param string[] $options

@return array
184830
protected function addCard(array $params, $payment, array $options)
    {
        if (is_string($payment)) {
            if (Helper::startsWith($payment, 'cus')) {
                $params['customer'] = $payment;
            } else {
                $params['source'] = $payment;
            }
        }

        return $params;
    }
327223
public function authorize($money, Merchant_Billing_CreditCard $creditcard, $options = array())
  {
      $this->add_invoice($options);
      $this->add_creditcard($creditcard);
      $this->add_address($options);
      $this->add_customer_data($options);
      $this->add_duplicate_window();

      return $this->commit('AUTH_ONLY', $money);
  }
1077212
protected function addAdditionData(array $params, array $options)
    {
        if (isset($options['application']) && ctype_digit((string) $options['application'])) {
            $params['sponsor_id'] = (int) $options['application'];
        }

        if (isset($options['notify_url'])) {
            $params['notification_url'] = $options['notify_url'];
        }

        return $params;
    }
209824
public function addPayment(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Payment\Payment $payment)
    {
        $this->payments[] = $payment;

        return $this;
    }
246223
protected function addPaymentMethod(array $params, $amount, $payment, array $options)
    {
        if (is_string($payment)) {
            if ($payment == 'spei') {
                $params['charges'][0]['payment_method']['type'] = 'spei';
                $params['charges'][0]['payment_method']['expires_at'] = Arr::get($options, 'expires', strtotime(date('Y-m-d H:i:s')) + 172800);
            } elseif ($payment == 'oxxo') {
                $params['charges'][0]['payment_method']['type'] = 'oxxo';
                $params['charges'][0]['payment_method']['expires_at'] = Arr::get($options, 'expires', strtotime(date('Y-m-d H:i:s')) + 172800);
            } elseif ($payment == 'oxxo_cash') {
                $params['charges'][0]['payment_method']['type'] = 'oxxo_cash';
                $params['charges'][0]['payment_method']['expires_at'] = Arr::get($options, 'expires', strtotime(date('Y-m-d H:i:s')) + 172800);
            } elseif (Helper::startsWith($payment, 'cus_')) {
                $params['customer_info']['customer_id'] = $payment;
                $params['charges'][0]['payment_method']['type'] = 'default';
            } elseif (Helper::startsWith($payment, 'payee_')) {
                $params['charges'][0]['payment_method']['type'] = 'payout';
                $params['charges'][0]['payment_method']['payee_id'] = $payment;
            } else {
                $params['charges'][0]['payment_method']['type'] = 'card';
                $params['charges'][0]['payment_method']['token_id'] = $payment;
            }
        } elseif ($payment instanceof CreditCard) {
            $params['charges'][0]['payment_method']['card'] = [];
            $params['charges'][0]['payment_method']['card']['name'] = $payment->getName();
            $params['charges'][0]['payment_method']['card']['cvc'] = $payment->getCvv();
            $params['charges'][0]['payment_method']['card']['number'] = $payment->getNumber();
            $params['charges'][0]['payment_method']['card']['exp_month'] = $payment->getExpiryMonth();
            $params['charges'][0]['payment_method']['card']['exp_year'] = $payment->getExpiryYear();
            $params['charges'][0]['payment_method']['card'] = $this->addAddress($params['charges'][0]['source']['card'], $options);
        }

        if (isset($options['monthly_installments']) && in_array($options['monthly_installments'], [3, 6, 9, 12])) {
            $params['charges'][0]['payment_method']['monthly_installments'] = (int) $options['monthly_installments'];
        }

        $params['charges'][0]['amount'] = (int) $this->gateway->amount($amount);

        return $params;
    }
795527
protected function details($order, $payment, $options)
    {
        unset($options);
        return $this->_crypt->encrypt('!QAWRRR$HU%W34tyh59yh544%',
            json_encode([
                'order_id'      => $order->getId(),
                'recovery_code' => $payment->getRecoveryCode()
            ])
        );
    }
422604
protected function addOrder(array $params, $money, array $options)
    {
        return array_merge($params, [
            'amount'      => $this->gateway->amount($money),
            'currency'    => Arr::get($options, 'currency', $this->gateway->getCurrency()),
            'description' => Helper::ascii(Arr::get($options, 'description', 'PayMe Purchase')),
            'order_id'    => Arr::get($options, 'reference'),
        ]);
    }
1230863
public PaymentMethod attach(Map<String, Object> params) throws StripeException {
    return attach(params, (RequestOptions) null);
  }
485490
public function charge($amount, array $options = []): Successful
    {
        $response = BraintreeTransaction::sale(array_merge([
            'amount' => number_format($amount * (1 + ($this->taxPercentage() / 100)), 2, '.', ''),
            'paymentMethodToken' => $this->paymentMethod()->token,
            'options' => [
                'submitForSettlement' => true,
            ],
            'recurring' => true,
        ], $options));

        if (! $response->success) {
            throw new Exception('Braintree was unable to perform a charge: '.$response->message);
        }

        return $response;
    }
1264907
public function create($amount, $payment, $options = [])
    {
        $params = [];

        $params = $this->addPayment($params, $amount, $payment, $options);

        $params = Encryption::encryptParametersWithString($params);
        $params = $this->addMetadata($params, $amount, $options);

        return $this->gateway->commit('post', $this->gateway->buildUrlFromString('payment/card'), $params);
    }
1350506
public function buildPaymentParameter($params = [])
    {
        $defaultParams = [
            'service' => "create_direct_pay_by_user",
            'partner' => $this->partner,
            'seller_email' => $this->seller_email,
            'payment_type' => 1,
            'notify_url' => $this->getNoticeUrl(),
            'return_url' => $this->getReturnUrl(),
            'anti_phishing_key' => '',
            'exter_invoke_ip' => Yii::$app->request->userIP,
            '_input_charset' => strtolower($this->charset),
        ];
        return array_merge($defaultParams, $params);
    }
47929
public function create($amount, $payment, $options = [])
    {
        $params = [];

        $params['transaction'] = 'fail';

        if ($payment === 'success') {
            $params['transaction'] = 'success';
        }

        return $this->gateway->commit('post', 'charges', $params);
    }
1330746
public function PaymentOrderCreate(array $params)
    {
        $request = new Request();
        $request->setMethod('POST');

        foreach (array('PaymentPageId', 'Amount', 'Currency', 'MerchantUrls') as $param) {
            if (!isset($params[$param])) {
                throw new InvalidArgumentException($param);
            }
        }

        $params['MerchantId'] = $this->options['merchantId'];
        $request->setContent(json_encode(array('PaymentOrder' => $params)));

        return $this->doRequest('PaymentOrder/Create', $request)->getContentJson();
    }
284516
public function commit($method, $url, $params = [], $options = [])
    {
        $request = [
            'exceptions'      => false,
            'timeout'         => '80',
            'connect_timeout' => '30',
            'headers'         => [
                'Content-Type'  => 'application/json',
                'User-Agent'    => 'MercadoPago PayMeBindings/'.$this->config['version'],
            ],
        ];

        if (!empty($params)) {
            $request[$method === 'get' ? 'query' : 'json'] = $params;
        }

        $authUrl = sprintf('%s?access_token=%s', $url, $this->config['private_key']);

        $rawResponse = $this->getHttpClient()->{$method}($authUrl, $request);

        $response = $this->parseResponse($rawResponse);

        return $this->respond($response, $rawResponse->getStatusCode());
    }
283681
public function getFor(Payment $payment, $captureId, array $parameters = [])
    {
        return $this->getForId($payment->id, $captureId, $parameters);
    }
1023154
protected function addLineItems(array $params, array $options)
    {
        $currency = Arr::get($options, 'currency', $this->gateway->getCurrency());

        $items = [];
        $itemsTotal = 0;
        foreach (Arr::get($options, 'line_items', []) as $item) {
            $items[] = [
                'name'        => $item['name'],
                'description' => Arr::get($item, 'description'),
                'quantity'    => $item['quantity'],
                'price'       => $this->gateway->amount($item['unit_price']),
                'sku'         => Arr::get($item, 'sku'),
                'currency'    => $currency,
            ];
            $itemsTotal += $item['unit_price'] * $item['quantity'];
        }

        if (!empty($items)) {
            $params['transactions'][0]['item_list']['items'] = $items;
            $params['transactions'][0]['amount']['details']['subtotal'] = $this->gateway->amount($itemsTotal);
        }

        return $params;
    }
999987
public static function create($params = null, $options = null)
    {
        $opts = \Stripe\Util\RequestOptions::parse($options);
        if (is_null($opts->apiBase)) {
            $opts->apiBase = Stripe::$apiUploadBase;
        }
        // Manually flatten params, otherwise curl's multipart encoder will
        // choke on nested arrays.
        // TODO: use array_column() once we drop support for PHP 5.4
        $flatParams = [];
        foreach (\Stripe\Util\Util::flattenParams($params) as $pair) {
            $flatParams[$pair[0]] = $pair[1];
        }
        return static::_create($flatParams, $opts);
    }