Omnipay\Alipay\AopAppGateway::purchase PHP Method

purchase() public method

public purchase ( array $parameters = [] ) : AopTradeAppPayRequest
$parameters array
return Omnipay\Alipay\Requests\AopTradeAppPayRequest
    public function purchase(array $parameters = [])
    {
        return $this->createRequest(AopTradeAppPayRequest::class, $parameters);
    }

Usage Example

Ejemplo n.º 1
0
 public function testPurchaseInline()
 {
     $testPrivateKey = ALIPAY_ASSET_DIR . '/dist/common/rsa_private_key_inline.pem';
     $this->gateway->setPrivateKey($testPrivateKey);
     /**
      * @var AopTradeAppPayResponse $response
      */
     $response = $this->gateway->purchase(['biz_content' => ['subject' => 'test', 'out_trade_no' => date('YmdHis') . mt_rand(1000, 9999), 'total_amount' => '0.01', 'product_code' => 'QUICK_MSECURITY_PAY']])->send();
     $this->assertTrue($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertNotEmpty($response->getOrderString());
 }
AopAppGateway