# Bank transfer

How to take a bank-transfer payment: create a pending bank transfer, wait for the callback, and treat `PAID` as funds received.

# Bank-transfer

### General

1. POST /pending-bank-transfer and get a synchronous response with `"pending_transaction_id"` `"origin_payme_id"` ,  `"sale_status": "RECEIVED"` and relevant bank details
2. Wait for a callback notification to the provided `"sale_callback_url"` URL.
3. On "sale_status": `"PAID"` - funds are transferred to the merchant account and fees are charged.

![flow.png](/guides-and-use-cases-migrated/_files/PcDpe1jQFR8.png)


| ENVIRONMENT | URL                                                  |
| ----------- | ---------------------------------------------------- |
| Sandbox     | <https://sandbox.payme.io/api/pending-bank-transfer> |
| Production  | <https://live.payme.io/api/pending-bank-transfer>    |

### pending-bank-transfer

#### POST Request
```
{
   "payme_client_key": "your partner client id here",
   "origin_payme_id": "Keep empty if 1st time, if 2nd time user - add MPL here",
   "target_payme_id":"Your seller account MPL - this is where you will get your money to ",
   "sale_price":1000000,
   "currency":"ILS",
   "product_name":"Cellular phone",
   "external_transaction_id":"12345",
   "sale_callback_url":"https://webhook.site/12346",
   "seller_email":"buyer@company.com",
   "seller_phone":"0501124411",
   "seller_merchant_name": "company name ltd",
   "seller_description": "An online store which specializes in rubber ducks",
   "seller_site_url": "www.babyduck22s.com",
   "seller_inc_code":"515123456",
   "seller_first_name":"אביב",
   "seller_last_name":"אברהם",
   "seller_social_id":"763438645",
   "seller_bank_code ": 54,
   "seller_bank_branch": 132,
   "seller_bank_account_number": "123456",
   "seller_address_city": "Tel Aviv",
   "seller_address_street": "Rothschild",
   "seller_address_street_number": "1",
   "seller_address_country": "IL",
   "risk": true,
   "data":{         },
   "test":true,
   "seller_id": null,
   "seller_birthdate": null,
   "seller_social_id_issued": null,
   "seller_gender": null,
   "seller_contact_email": null,
   "seller_contact_phone": null,
   "seller_person_business_type": null,
   "seller_inc": null,
   "seller_retail_type": null,
   "market_fee": null
}

```


❗ \*seller_bank_account_number - PayMe will expect the transfer to arrive from the origin bank account and will use this infomration to automatically match the payments.
in case money is trnasfered from a different account - expect longer time to process the transaction.

#### Reponse

200
```
{
  "origin_payme_id": "MPL1XXXXXXXX",
  "pending_transaction_id": "fcfbb481-94d0-421b-95f8-689610766491",
  "external_transaction_id": "12345",
  "status": "RECEIVED",
  "bank_transfer_details": {
    "bank_name": "בנק הפועלים",
    "bank_code": "12",
    "bank_branch":"778", 
    "bank_account_number": "86684",
    "reference": "772012"
  }
}

```

❗ \*reference  - A unique reference code to identify the bank transfer. Instruct your customer to include this code in the reference field of their bank transfer.
Transfers without reference will take longer time to reconcile due to manual processes.

*Origin_payme_id - Save this MPL for any future additioanl request from the same buyer.

500

in case of error or data not sufficient

#### Callback

Once the sale is paid successfully (PAID), we will notify the marketplace with the sale details with a POST to the callback URL.

```
{
  "pending_transaction_id": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "external_transaction_id": "132456",
  "status": "PAID",
  "status_details": "",
  "sale_price": 10000,
  "currency": "ILS",
  "sale_paid_date": "1970-01-20T05:05:51.972Z",
  "seller_merchant_name": "company name ltd",
  "seller_email": "buyer@company.com",
  "seller_inc_code": "515123456"
}

```

### Risk sale approved

 "status": "PAID",
 "status_details": "Risk approved",

### Risk sale rejected

No callback

### Get-sales

You can retrieve data on different sales processed by your sellers using this endpoint.

### Handling under and over-payments

Due to low volume of unmatched transactions, Expect manual notifications to your account email address.

### Cancel-sale

You can only cancel-sale if the status of the sale is ‘RECEIVED’

#### POST Request
