PHP code example of paymill / paymill

1. Go to this page and download the library: Download paymill/paymill library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

paymill / paymill example snippets






 $request = new Paymill\Request($apiKey);
 

 $payment = new \Paymill\Models\Request\Payment();
 $payment->setToken("098f6bcd4621d373cade4e832627b4f6");
 

 $response  = $request->create($payment);
 $paymentId = $response->getId();
 

try {
  $response  = $request->create($payment);
  $paymentId = $response->getId();
} catch(\Paymill\Services\PaymillException $e){
  //Do something with the error informations below
  $e->getResponseCode();
  $e->getStatusCode();
  $e->getErrorMessage();
  $e->getRawError();
}

$response  = $request->create($payment);
$response->getId();

$request->create($payment);
$response = $request->getLastResponse();
$response['body']['data']['id'];

$request->create($payment);
$response = $request->getJSONObject();
$response->data->id;

Paymill\Services\PaymillException: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed