อัปเดต Recipient
อัปเดตรายละเอียด Recipient รวมถึงชื่อ อีเมล คำอธิบาย และ metadata โปรดทราบว่าไม่สามารถอัปเดตข้อมูลบัญชีธนาคารได้
พารามิเตอร์คำขอ
จำเป็น - 1 ฟิลด์พารามิเตอร์ที่จำเป็น
`id`STRING(required)
Recipient ID (เช่น recp_test_...) ระบุใน URL path
เพิ่มเติม - 4 ฟิลด์พารามิเตอร์เพิ่มเติม
`name`STRING(optional)
ชื่อ Recipient ที่อัปเดต
`email`STRING(optional)
อีเมลที่อัปเดต
`description`STRING(optional)
คำอธิบายที่อัปเดต
`metadata`OBJECT(optional)
metadata ที่อัปเดต (แทนที่ metadata ที่มีอยู่ทั้งหมด)
การตอบกลับ
200
สำเร็จอัปเดต Recipient สำเร็จ ส่งกลับออบเจกต์ Recipient ที่อัปเดตแล้ว
แอตทริบิวต์ Recipient ที่ส่งกลับ:
object- ค่า "recipient"id- ตัวระบุ Recipient (recp_*)livemode- โหมดไลฟ์หรือโหมดทดสอบlocation- พาธ API ไปยังออบเจกต์ Recipientactivated_at- timestamp การเปิดใช้งาน (ISO 8601)active- Recipient เปิดใช้งานอยู่หรือไม่bank_account- ออบเจกต์บัญชีธนาคารปลายทางcreated_at- timestamp การสร้าง (ISO 8601)default- Recipient เป็นค่าเริ่มต้นของบัญชีหรือไม่deleted- Recipient ถูกลบหรือไม่description- คำอธิบาย Recipientemail- อีเมล Recipientfailure_code- รหัสเหตุผลความล้มเหลว (name_mismatch, account_not_found, bank_not_found)metadata- metadata ที่กำหนดเองname- ชื่อ Recipientschedule- ตารางการโอนเงิน (ขยายได้)tax_id- เลขประจำตัวผู้เสียภาษีของ Recipienttype- ประเภท Recipient (individual, corporation)verified- Recipient ได้รับการยืนยันหรือไม่verified_at- timestamp การยืนยัน (ISO 8601)
400
คำขอไม่ถูกต้องกา รตรวจสอบคำขอล้มเหลว ตรวจสอบข้อความแสดงข้อผิดพลาดสำหรับรายละเอียด
สาเหตุทั่วไป:
- รูปแบบอีเมลไม่ถูกต้อง
- รูปแบบ metadata ไม่ถูกต้อง
- metadata เกิน 15,000 ตัวอักษร
401
ไม่ได้รับอนุญาตการยืนยันตัวตนล้มเหลว API key ไม่ถูกต้องหรือหายไป
สาเหตุทั่วไป:
- ไม่มี Authorization header
- Secret key ไม่ถูกต้อง
- ใช้ public key แทน secret key
- รูปแบบ HTTP Basic Auth ไม่ถูกต้อง
404
ไม่พบไม่พบ Recipient
สาเหตุทั่วไป:
- Recipient ID ไม่ถูกต้อง
- Recipient ไม่ได้อยู่ในบัญชีของคุณ
- Recipient ถูกลบแล้ว
- ใช้ ID โหมดทดสอบและโหมดไลฟ์ปนกัน
5xx
ข้อผิดพลาดเซิร์ฟเวอร์เกิดข้อผิดพลาดฝั่งเซิร์ ฟเวอร์ ซึ่งเกิดขึ้นไม่บ่อยแต่ควรจัดการอย่างเหมาะสม
วิธีจัดการ:
- ลองคำขอใหม่ด้วย exponential backoff
- ตรวจสอบ status.omise.co สำหรับเหตุการณ์บริการ
- ดู การจัดการข้อผิดพลาด สำหรับคำแนะนำโดยละเอียด
ตัวอย่างโค้ด
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/recipients/recp_test_5xuy4w91xqz7d1w9u0t \
-X PATCH \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "name=John Smith" \
-d "email=john.smith@example.com"
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
recipient = Omise::Recipient.update('recp_test_5xuy4w91xqz7d1w9u0t', {
name: 'John Smith',
email: 'john.smith@example.com'
})
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
recipient = omise.Recipient.retrieve('recp_test_5xuy4w91xqz7d1w9u0t')
recipient.name = 'John Smith'
recipient.email = 'john.smith@example.com'
recipient.update()
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const recipient = await omise.recipients.update('recp_test_5xuy4w91xqz7d1w9u0t', {
name: 'John Smith',
email: 'john.smith@example.com'
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$recipient = OmiseRecipient::retrieve('recp_test_5xuy4w91xqz7d1w9u0t');
$recipient->update([
'name' => 'John Smith',
'email' => 'john.smith@example.com'
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Recipient recipient = client.recipients()
.update("recp_test_5xuy4w91xqz7d1w9u0t")
.name("John Smith")
.email("john.smith@example.com")
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var recipient = await client.Recipients.Update("recp_test_5xuy4w91xqz7d1w9u0t", new UpdateRecipientRequest
{
Name = "John Smith",
Email = "john.smith@example.com"
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
recipient, _ := client.Recipients().Update("recp_test_5xuy4w91xqz7d1w9u0t", &operations.UpdateRecipient{
Name: "John Smith",
Email: "john.smith@example.com",
})
หมายเหตุสำคัญ
- ไม่สามารถอัปเดตข้อมูลบัญชีธนาคารได้
- หากต้องการเปลี่ยนบัญชีธนาคาร ให้ลบ Recipient และสร้างใหม่
- พารามิเตอร์ metadata จะแทนที่ metadata ที่มีอย ู่ทั้งหมด
- หากต้องการรักษา metadata ที่มีอยู่ ให้ดึงข้อมูล Recipient ก่อนแล้วผสานรวม
ข้อมูลยืนยันตัวตน API
ลองใช้งาน
จำเป็น - 1 ฟิลด์
เพิ่มเติม - 4 ฟิลด์
IP ของคุณ:
...กำลังโหลด...