Payment SMS Link
Send a hosted payment link to a customer via SMS. The customer opens the link and completes payment on the hosted checkout page.
Payment SMS Link
POST /v1/transactions/sms-link
Sends a hosted checkout URL to a customer's phone via SMS. Unlike direct payment, the customer opens the link and pays at their own time — no USSD prompt or in-app authorization required.
Use this when the customer is not present or when you want a frictionless experience without requiring the customer to be on a phone call. Ideal for invoicing, bill payment, and remote collections.
Connect
This endpoint can't be called on behalf of a connected business: requests with
the ePay-Account header are rejected with insufficient_scope.
Request
npm install @e-pay/nodenpm install @e-pay/nestjspip install epaypip install epaypip install epaypip install epaycomposer require epay-et/php-sdkcomposer require epay-et/php-sdkimplementation("com.epayethiopia:epay-java:0.1.0")implementation("com.epayethiopia:epay-spring-boot-starter:0.1.0")go get github.com/epay-et/go-sdkNothing NestJS-specific here — this is the same Node.js client call.
Nothing Django-specific here — this is the same Python client call.
Nothing Flask-specific here — this is the same Python client call.
Nothing FastAPI-specific here — this is the same Python client call.
Nothing Laravel-specific here — this is the same PHP client call.
Nothing Spring Boot-specific here — this is the same Java client call.
curl https://api.e-pay.et/v1/transactions/sms-link \
-X POST \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerPhone": "+251911234567",
"currencyCode": "ETB",
"amount": "500.00"
}'import { Epay } from '@e-pay/node';
const epay = new Epay({ apiKey: process.env.EPAY_SECRET_KEY });
const link = await epay.payments.sendSmsLink({
customerPhone: '+251911234567',
currencyCode: 'ETB',
amount: '500.00', // omit to let the customer enter the amount
});
// link.checkoutUrl is valid for 1 hour; the outcome arrives at your webhook.const res = await fetch(
'https://api.e-pay.et/v1/transactions/sms-link',
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.EPAY_SECRET_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
customerPhone: '+251911234567',
currencyCode: 'ETB',
amount: '500.00',
}),
},
);
if (!res.ok) throw new Error(`ePay ${res.status}: ${await res.text()}`);
const { message, checkoutUrl, customerPhone } = (await res.json()).data;from epay import Epay
epay = Epay() # reads EPAY_SECRET_KEY
link = epay.payments.send_sms_link(
customer_phone="+251911234567",
currency_code="ETB",
amount="500.00", # omit to let the customer enter the amount
)
# link["checkoutUrl"] is valid for 1 hour; the outcome arrives at your webhook.import os
import requests
res = requests.post(
"https://api.e-pay.et/v1/transactions/sms-link",
headers={
"Authorization": f"Bearer {os.environ['EPAY_SECRET_KEY']}",
},
json={
"customerPhone": "+251911234567",
"currencyCode": "ETB",
"amount": "500.00",
},
timeout=30,
)
res.raise_for_status()
data = res.json()["data"]
checkout_url = data["checkoutUrl"]use Epay\Epay;
$epay = new Epay(); // reads EPAY_SECRET_KEY
$link = $epay->payments->sendSmsLink([
'customerPhone' => '+251911234567',
'currencyCode' => 'ETB',
'amount' => '500.00', // omit to let the customer enter the amount
]);
// $link['checkoutUrl'] is valid for 1 hour; the outcome arrives at your webhook.$ch = curl_init('https://api.e-pay.et/v1/transactions/sms-link');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('EPAY_SECRET_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'customerPhone' => '+251911234567',
'currencyCode' => 'ETB',
'amount' => '500.00',
]),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("ePay {$status}: {$body}");
}
$data = json_decode($body, true)['data'];
$checkoutUrl = $data['checkoutUrl'];client, err := epay.NewClient() // reads EPAY_SECRET_KEY
if err != nil {
return err
}
link, err := client.Payments.SendSMSLink(ctx, epay.SMSLinkParams{
CustomerPhone: "+251911234567",
CurrencyCode: "ETB",
Amount: "500.00", // leave empty to let the customer enter the amount
})
if err != nil {
return err
}
// The link is valid for 1 hour; the outcome arrives at your webhook.
log.Printf("checkout link sent to %s", link.CustomerPhone)payload, _ := json.Marshal(map[string]string{
"customerPhone": "+251911234567",
"currencyCode": "ETB",
"amount": "500.00",
})
req, _ := http.NewRequestWithContext(ctx, http.MethodPost,
"https://api.e-pay.et/v1/transactions/sms-link", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("EPAY_SECRET_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode >= 400 {
return fmt.Errorf("ePay %d", res.StatusCode)
}
var envelope struct {
Data struct {
Message string `json:"message"`
CheckoutURL string `json:"checkoutUrl"`
CustomerPhone string `json:"customerPhone"`
Amount *string `json:"amount"`
CurrencyCode string `json:"currencyCode"`
} `json:"data"`
}
if err := json.NewDecoder(res.Body).Decode(&envelope); err != nil {
return err
}
data := envelope.Data // every response is {"status": "success", "data": …}import com.epayethiopia.epay.Epay;
import com.epayethiopia.epay.SmsLinkParams;
import com.epayethiopia.epay.model.SmsLink;
Epay epay = Epay.fromEnvironment(); // reads EPAY_SECRET_KEY; thread-safe, share one
SmsLink link = epay.payments().sendSmsLink(SmsLinkParams.builder()
.customerPhone("+251911234567")
.currencyCode("ETB")
.amount("500.00") // omit to let the customer enter the amount
.build());
// link.checkoutUrl() is valid for 1 hour; the outcome arrives at your webhook.HttpClient http = HttpClient.newHttpClient();
String body = """
{
"customerPhone": "+251911234567",
"currencyCode": "ETB",
"amount": "500.00"
}
""";
HttpRequest request = HttpRequest.newBuilder(
URI.create("https://api.e-pay.et/v1/transactions/sms-link"))
.header("Authorization", "Bearer " + System.getenv("EPAY_SECRET_KEY"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = http.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) {
throw new IllegalStateException("ePay " + response.statusCode() + ": " + response.body());
}
// {"status":"success","data":{"message":"Checkout link sent via SMS","checkoutUrl":"…","customerPhone":"…","amount":"500.00","currencyCode":"ETB"}}
String responseBody = response.body();import { Controller, Param, Post } from '@nestjs/common';
import { EpayService } from '@e-pay/nestjs';
@Controller('invoices')
export class InvoiceController {
constructor(
private readonly epay: EpayService,
private readonly invoices: InvoicesService,
) {}
@Post(':id/send')
async send(@Param('id') id: string) {
const invoice = await this.invoices.find(id);
const link = await this.epay.payments.sendSmsLink({
customerPhone: invoice.customerPhone,
currencyCode: 'ETB',
amount: invoice.total,
});
return { sentTo: link.customerPhone };
}
}from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_POST
from .clients import epay # Epay(api_key=settings.EPAY_SECRET_KEY)
from .models import Invoice
@require_POST
def send_invoice(request, invoice_id):
invoice = get_object_or_404(Invoice, pk=invoice_id)
link = epay.payments.send_sms_link(
customer_phone=invoice.customer_phone,
currency_code="ETB",
amount=invoice.total,
)
return JsonResponse({"sentTo": link["customerPhone"]})from flask import jsonify
from app import app, epay # epay = Epay(), one per process
@app.post("/invoices/<invoice_id>/send")
def send_invoice(invoice_id):
invoice = Invoice.query.get_or_404(invoice_id)
link = epay.payments.send_sms_link(
customer_phone=invoice.customer_phone,
currency_code="ETB",
amount=invoice.total,
)
return jsonify(sentTo=link["customerPhone"])from app.main import app, epay # epay = AsyncEpay(), closed in lifespan
@app.post("/invoices/{invoice_id}/send")
async def send_invoice(invoice_id: str):
invoice = await invoices.get(invoice_id)
link = await epay.payments.send_sms_link(
customer_phone=invoice.customer_phone,
currency_code="ETB",
amount=invoice.total,
)
return {"sentTo": link["customerPhone"]}use App\Models\Invoice;
use Epay\Epay;
use Illuminate\Http\JsonResponse;
final class InvoiceController
{
public function __construct(private readonly Epay $epay) {}
public function send(Invoice $invoice): JsonResponse
{
$link = $this->epay->payments->sendSmsLink([
'customerPhone' => $invoice->customer_phone,
'currencyCode' => 'ETB',
'amount' => $invoice->total,
]);
return response()->json(['sentTo' => $link['customerPhone']]);
}
}
// routes/web.php
// Route::post('/invoices/{invoice}/send', [InvoiceController::class, 'send']);@RestController
class InvoiceController {
private final Epay epay;
private final Invoices invoices;
InvoiceController(Epay epay, Invoices invoices) {
this.epay = epay;
this.invoices = invoices;
}
@PostMapping("/invoices/{id}/send")
Map<String, String> send(@PathVariable String id) {
Invoice invoice = invoices.find(id);
SmsLink link = epay.payments().sendSmsLink(SmsLinkParams.builder()
.customerPhone(invoice.phone())
.currencyCode("ETB")
.amount(invoice.total())
.build());
return Map.of("sentTo", link.customerPhone());
}
}Response
{
"status": "success",
"data": {
"message": "Checkout link sent via SMS",
"checkoutUrl": "https://api.e-pay.et/v1/sms/p/ps_live_abc123?phone=%2B251911234567&amount=500.00&sig=…&exp=…",
"customerPhone": "+251911234567",
"amount": "500.00",
"currencyCode": "ETB"
}
}- Your server calls
POST /v1/transactions/sms-linkwith the customer's phone and optional amount. - ePay sends an SMS with a signed checkout URL to the customer.
- The customer opens the link and completes payment on the hosted checkout page with their phone pre-filled.
- ePay delivers the outcome (
payment.successorpayment.failed) to your webhook.
Headers
Prop
Type
Body
Prop
Type
Response
Returns 200 OK. Every response is wrapped as { "status": "success", "data": … }; the fields below are inside data.
Prop
Type
Amount Signing
When an amount is provided, it is cryptographically signed into the URL. This prevents tampering — if the URL is modified, the checkout page will reject it. The link expires after 1 hour.
Errors
| Status | Description |
|---|---|
400 | Invalid phone number or unrecognized currency. |
401 | Missing or invalid API key. |
429 | Rate limit exceeded. |
Next: Webhooks — receive real-time payment outcomes.