Esempio n. 1
0
 /**
  * Create a new card token
  *
  * @param  array  $aOptions  Creation options :
  * - number: string, Number of card
  * - expiry: array, Expiry date of the card, with:
  *   - year: integer
  *   - month: integer
  * - security: string, Security code (CVV, CVC, etc.)
  * - user: string, Email or hash of the owner of the card
  *
  * @return  array  API response data
  */
 public static function create($aOptions)
 {
     $aCallOpts = array('url' => '/token', 'postData' => $aOptions);
     $aRes = Payname::post($aCallOpts);
     return $aRes['data'];
 }
Esempio n. 2
0
 /**
  * Delete a doc
  *
  * @throw  \Payname\Exception  On API error
  *
  * @return  mixed  API response, if any
  */
 public function delete()
 {
     $aCallOpts = array('url' => '/user/' . $this->user . '/doc/' . $this->hash);
     $aResult = Payname::delete($aCallOpts);
     return isset($aResult['data']) ? $aResult['data'] : null;
 }
Esempio n. 3
0
 /**
  * Create a popup for current shop
  *
  * @param  array  $aOptions  Creation options:
  * - `amount`           (float)   *Required.* Amount to pay in the popup
  * - `callback_ok`      (string)  *Optional.* Once payment is finished,
  *   redirect to this URL instead of closing the popup
  * - `callback_cancel`  (string)  *Optional.* If user cancels (button),
  *   redirect to this URL instead of closing the popup
  *
  * @throw  \Payname\Exception  On API error
  *
  * @return  string  URL to open in popup
  */
 public static function create($aOptions)
 {
     $aRes = \Payname\Payname::post(array('url' => '/popup', 'postData' => $aOptions));
     return $aRes['data']['url'];
 }
Esempio n. 4
0
 /**
  * Delete payment on the platform
  *
  * @throw  \Payname\Exception  On API error
  *
  * @return  Payment  Current payment instance
  */
 public function delete()
 {
     $aCallOpts = array('url' => '/payment/' . $this->hash);
     $aResult = Payname::delete($aCallOpts);
     $this->_load($aResult['data']);
     return $this;
 }
Esempio n. 5
0
 /**
  * Refresh a token
  */
 public static function refreshToken()
 {
     $aOptions = array('url' => '/auth/refresh_token', 'postData' => array('ID' => \Payname\Config::ID, 'token' => \Payname\Payname::token()));
     \Payname\Payname::post($aOptions);
 }