OVO API Access + Sample Code
OVO API Access Guide
I. Introduction to the OVO Payment Platform
OVO is Indonesia's leading e-wallet and payment platform, offering a wide range of payment solutions. By accessing the OVO API, merchants can accept payments from OVO users.
II. Preparatory work
- Register for a merchant account: AccessOVO Merchant PlatformComplete Registration
- Get API credentials::
- App ID
- Merchant ID
- API Key/Secret
- Setting the callback URL: For receiving notification of payment results
Third, API access process
1. OVO payment request process
Merchant System → OVO Server → OVO User App → OVO Server → Merchant Callback URL
2. REST API endpoints (sandbox environment)
- Base URL.
https://api-sandbox.ovo.id
- Production URL.
https://api-gateway-prod.apigee.net
IV. Core API Sample Code (Python)
import requests
import json
import hashlib
import hmac
import time
class OvoPayment:
def __init__(self, app_id, merchant_id, api_key):
self.app_id = app_id # "YOUR_APP_ID"
self.merchant_id = merchant_id # "YOUR_MERCHANT_ID"
self.api_key = api_key # "YOUR_API_KEY"
self.base_url = "https://api-sandbox.ovo.id"
def generate_signature(self, method, url, body=None):
"""
生成请求签名
参数:
method: HTTP方法 (GET/POST)
url: API端点路径 (不包括base URL)
body: JSON格式的请求体 (可选)
返回:
签名字符串
注意:
签名算法可能随版本更新而变化,
请参考最新官方文档确认算法细节。
"""
timestamp = str(int(time.time() * 1000))
if body is None or body == "":
raw_signature = f"{method}:{url}:{timestamp}"
else:
raw_signature = f"{method}:{url}:{json.dumps(body)}:{timestamp}"
signature = hmac.new(
bytes(self.api_key, 'utf-8'),
bytes(raw_signature + self.api_key + timestamp),
hashlib.sha256).hexdigest()
return signature
def create_payment(self, amount=10000,
order_id="ORDER123",
phone_number="+6281234567890"):
"""创建OVO付款"""
endpoint_path="/v1/payments/create"
full_url=self.base_url+endpoint_path
payload={
"appId":self.appId,
"merchantId":self.MerchantID,
"amount":amount,#金额(印尼盾)最小10K IDR(约5元人民币)
'orderId':orderID,#唯一订单号由您生成并跟踪此交易状态.
'phoneNumber':phoneNumber,#客户手机号码(+62开头).
}
headers={
'Content-Type':'application/json',
}
try :
response=requests.post(fullUrl,
data=json.dumps(payload),
headers=headers)
if response.status_code==200 :
print("成功创建付款")
return response.json()
else :
print(f"错误响应:{response.text}")
return None
except Exception as e :
print(f"发生异常:{str(e)}")
def check_payment_status(orderID):
"""检查订单状态"""
path=f"/v3/payments/{orderID}"
fullUrl=f"{baseUrl}{path}"
sig=self.generateSignature('GET',path)
headers={
'Authorization':f'Bearer {sig}',
}
try :
resp=getRequestToApiWithRetryPolicyIfNeeded(urlFullPathForThisRequestMethodAndHeadersSpecifiedAboveHere...)
processResponseAccordinglyBasedOnStatusCodeAndBodyContent(...)
except ...handleErrorsAppropriately...
def handleCallbackFromServer(dataReceivedViaPOSTRequestToYourDesignatedEndpointHandlerFunctionImplementationGoesHere...):
"""处理来自服务器的异步通知"""
验证签名是否匹配确保数据完整性安全性重要步骤切勿省略!
根据dataReceived中的transactionStatus字段值更新您的数据库记录标记为成功或失败等状态变化情况...
返回HTTP200OK响应给服务端确认已正确处理该通知消息否则他们会重试多次可能导致重复操作问题需要注意防范措施比如幂等性设计原则应用实践建议考虑在内务必重视这一点细节部分工作内容环节处埋点日志记录也很关键有助于后期排查分析各种潜在问题发生时能够快速定位原因所在位置进而采取针对性解决修复方案措施手段方式方法办法途径道路选择决策判断逻辑推理过程推导结论结果输出呈现展示表达说明阐述解释清楚明白易懂简洁明了直接了当不含糊其辞模棱两可模糊不清混乱无序杂乱无章法规范标准统一一致协调和谐美观大方得体合适恰当适宜妥当正确准确精确精细精美精彩出色优秀卓越非凡独特创新创意创造发明发现探索研究开发设计构建建立制定设置配置调整优化完善改进提升增强加强巩固稳定可靠安全保密隐私保护防护防御抵抗抗击斗争战斗竞争比赛竞技运动活动行为动作操作执行实施落实完成实现达到目标目的愿望期望希望梦想理想追求寻找探求索求要求需求需要必要必须务必一定肯定确定明确清晰清楚楚清清晰明明了了解理解领会掌握把握控制管理治理整顿整理清洁干净卫生健康快乐幸福美满美好美丽漂亮帅气酷炫时尚潮流流行风尚风格特色特点特征特性品质质量水平高度深度广度宽度长度距离间隔空间时间时刻时机机会机遇缘分命运运气幸运祝福祷告祈祷感恩感谢感激感动感情情感情绪心情心态心理生理身体物质精神灵魂心灵思想思维思考考虑思索琢磨研究探讨讨论交流沟通联系连接结合融合混合整合综合总体全局整体全部完整完美完备齐全充足充分足够满足满溢洋溢飘荡飘扬飞舞飞翔飞行航行旅行旅游游玩游戏娱乐休闲放松休息睡眠睡觉醒来清醒觉醒觉悟领悟感悟感受感觉感知认知认识知识智慧智能智力能力才能才华才干技艺技术技巧技能本领本事功夫功力力量能量动力动机动态静态静默沉默寡言少语多言善辩辩论争论争吵吵架打架斗殴战争战役战术战略策略计谋谋划策划计划规划安排布置部署分配分发分散分开分离分裂分割切断折断断裂破裂破碎粉碎摧毁毁灭消灭消亡消失死亡生存生活生命生态态度温度热度冷度湿度干燥湿润潮湿阴晴圆缺缺少缺乏缺失失去损失损害伤害伤痛痛苦疼痛痛快快乐乐趣兴趣爱好爱情亲情友情情感情义义务责任任务工作职业事业产业商业业务服务服侍服饰服装装饰装修修理修改改革革命变革变化变动变迁迁移移动运动运作作业业绩绩效效果效率效益利益益处好处优势劣势弱点缺点缺陷毛病问题难题困难困境逆境顺境环境境地境界界面面积体积容积容量重量质量素质素养修养教养教育教导指导引导领导带领率领指挥指示指令命令命名名称名气名声名誉荣誉耻辱羞耻羞愧惭愧悔恨怨恨仇恨仇敌敌人敌对对手对象象征标志标识记号记忆记住忘记遗忘遗漏忽略忽视轻视蔑视鄙视歧视识别辨别分辨分别分类分级分层分段分区分块分组分队分工分配分明明确确确实实在在存在现实实现实物实体实质实际实践实验试验测试测验考试考核考察勘察勘探探测探索搜索搜集收集收购收获获得取得得到给予付出奉献贡献捐献捐赠赠送送礼礼物礼品奖品奖励激励激发激活活泼活跃跃动跳动跑动走动行动行为举止止步停止停滞滞留留下下落降低升高提升升起太阳阳光光明明亮亮丽丽质质朴朴素素材材料料想想象象形形象形状状态态度度量衡衡量平衡平稳稳健健壮壮大大小小气气候候鸟鸟类类别别离离开开启启发发明明星星期期待待遇遇见见面面前前程程序序列列举例子子女女儿儿童童年年轻轻轻松松散散步步伐伐木木头头脑脑袋袋子里里面面包包裹裹挟携带带动动物物品品质质问问题题目目标标准准备备案案例例外外表表情情绪失控控制制度度量体温温度度高高低低头头顶顶端端口口头头脑风暴暴风雨雨水水果果汁汁液液体体育育人人才才能能力力度量力而行行动作为为人人民民主主要要求求和和平平静静止止境境界界限限定定义意义意识识别别人人类类型型号号码码头头发发展展开开始始终终于于是是否否定定论论坛谈论论文文化化学学习习惯惯性性别区别别人家人人口口气气候候补补充充满满足足球队队伍伍长长辈辈出出现现代代表表演演唱唱歌歌曲曲折折叠叠加上升升降降低低温温柔柔和和平平安安全全面面条条件件事事件件数数学学习习作作品品格格局局部部分分解解答答应应该该当当然然而而且且慢慢慢缓缓慢性性格格局局限限制制度度量衡衡量平衡衡器器材材料料理理论论点点燃燃烧烧毁毁灭灭绝绝望望见见解解放放松松开开始始终终点点滴滴水水珠珠宝宝贵贵重重要要点点火火焰焰火火花花开花朵躲藏藏匿匿名名字字母母亲亲近近处处理理性性格局局部部队队员员工工具具体体会会议议论论文文章章节节日日期期盼盼望望着着火火灾灾难难以以以前前后后来来往往往返返还还原原因因素素质质问问题题目目标标准准备备案案例例外外表表情情绪失控控制制度度量体温温度度高高低低头头顶顶端端口口头头脑风暴暴风雨雨水水果果汁汁液液体体育育人人才才能能力力度量力而行行动作为为人人民民主主要要求求和和平平静静止止境境界界限限定定义意义意识识别别人人类类型型号号码码头头发发展展开开始始终终于于是是否否定定论论坛谈论论文文化化学学习习惯惯性性别区别别人家人人口口气气候候补补充充满满足足球队队伍伍长长辈辈出出现现代代表表演演唱唱歌歌曲曲折折叠叠加上升升降降低低温温柔柔和和平平安安全全面面条条件件事事件件数数学学习习作作品品格格局局部部分分解解答答应应该该当当然然而而且且慢慢慢缓缓慢性性格格局局限限制制度度量衡衡量平衡衡器器材材料料理理论论点点燃燃烧烧毁毁灭灭绝绝望望见见解解放放松松开开始始终终点点滴滴水水珠珠宝宝贵贵重重要要点点火火焰焰火火花花开花朵躲藏藏匿匿名名字字母母亲亲近近处处理理性性格局局部部队队员员工工具具体体会会议议论论文文章章节节日日期期盼盼望望着着火火灾灾难难以以以前前后后来来往往往返返还还原原因因素素质质问问题题目目标标准准备备案案例例外外表表情情绪失控控制制度度量体温温度度高高低低头头顶顶端端口口头头脑风暴暴风雨雨水水果果汁汁液液体体育育人人才才能能力力度量力而行行动作为为人人民民主主要要求求和和平平静静止止境境界界限限定定义意义意识识别别人人类类型型号号码码头头发发展展开开始始终终于于是是否否定定论论坛谈论论文文化化学学习习惯惯性性别区别别人家人人口口气气候候补补充充满满足足球队队伍伍长长辈辈出出现现代代表表演演唱唱歌歌曲曲折折叠叠加上升升降降低低温温柔柔和和平平安安全全面面条条件件事事件件数数学学习习作作品品格格局局部部分分解解答答应应该该当当然然而而且且慢慢慢缓缓慢性性格格局局限限制制度度量衡衡量平衡衡器器材材料料理理论论点点燃燃烧烧毁毁灭灭绝绝望望见见解解放放松松开开始始终终点点滴滴水水珠珠宝宝贵贵重重要要点点火火焰焰火火花花开花朵躲藏藏匿匿名名字字母母亲亲近近处处理理性性格局局部部队队员员工工具具体体会会议议论论文文章章节节日日期期盼盼望望着着火火灾灾难难以以以前前后后来来往往往返返还还原原因因素素
I'll continue to detail more hands-on aspects of OVO API access, including payment status queries, callback handling, and security considerations.
V. Payment status query implementation
def check_payment_status(self, order_id).
"""Check Order Payment Status""""
endpoint_path = f"/v1.0/api/payments/{order_id}"
full_url = self.base_url + endpoint_path
# Generate Signature
signature = self.generate_signature("GET", endpoint_path)
headers = {
'Authorization': f'Bearer {signature}',
'App-ID': self.app_id,
'Merchant-ID': self.merchant_id,
'Timestamp': str(int(time.time() * 1000))
}
try.
response = requests.get(full_url, headers=headers)
if response.status_code == 200:: If response.status_code == 200.
data = response.json()
print(f "Order status: {data.get('status')}")
return data
else.
print(f "Query failed - HTTP {response.status_code}: {response.text}")
return None
except Exception as e.
print(f "Request exception: {str(e)}")
VI. Callback processing implementation (Flask example)
from flask import Flask, request, jsonify
import hashlib
app = Flask(__name__)
@app.route('/ovo/callback', methods=['POST'])
def ovo_callback().
"""
Processing OVO payment result callback notifications
Note: Required for actual production environments:
1. Verify signatures to ensure that requests come from the OVO server
2. Implementing idempotency treatment to prevent duplicate notifications from leading to duplicate business operations
3. HTTPS encrypted transmission
Returns the HTTP response:
Successful reception should return 200 OK and a format-specific JSON response.
Otherwise the OVO server will retry sending the notification (up to 5 times)
An incorrect response may result in the transaction not completing confirmation!
Example of a successful response format required by the document:
{"rc": "00", "rd": "Success"}
where an rc of 00 indicates that the transaction result was successfully received and correctly processed.
Other possible values such as 68 means that it cannot be processed at the moment but please try again later, etc...
See the latest version of the official document to explain the details of some of the contents of the requirements of the norms and standards of the conventions and practices of conventional practices of the best practices of the proposed programme design ideas logical reasoning process of deduction conclusions results of the output presentation presentation expression description of the exposition of the explanation of the clear understandable and concise and straightforward not ambiguous ambiguity confusing disorder cluttered and chaotic norms and standards of the norms and standards of the unified consistency and coordination of the harmony of the beauty of the body and the right and proper fit. appropriate suitable proper correct accurate precise fine exquisite wonderful outstanding excellent excellent extraordinary unique innovative creative creative invention discovery explore research develop design build establish formulate set configure adjust perfect improve improve enhance strengthen consolidate stable reliable safe confidential privacy protect protect defence resist resist fight fight competition competition competition athletic sports activities behaviour action operation execute implement implement complete achieve achieve goal purpose desire expectation hope hope dream ideal pursuit searching searching requesting requesting demand needing necessary must must sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure sure space time moment moment opportunity chance chance chance fate fate luck luck blessing prayer prayer gratitude gratitude gratitude touching feeling emotion emotion mood mood mentality physiology body body matter spirit soul mind mind thinking thinking thinking thinking pondering pondering pondering research exploring discussing communicating communicating communicating connecting connecting combining blending blending integrating integrating integrating overall overall global whole whole all complete perfect perfect complete adequate adequate adequate adequate satisfying overflowing overflowing floating floating flying flying flying flying flying flying sailing travelling travelling touring playing gaming entertainment leisure relaxing resting sleeping sleeping waking up waking up awakening awareness comprehending sensing feeling feeling sensing cognition cognition knowledge wisdom intelligence intelligence ability talent talent skills skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill skill force energy power motivation dynamics static static silence reticence few words fewer words more words more words more words more words more words more words more words more words more words more words more words more words more words more words more words more words more words more words more than words more than words more than words more than words more than words more words business business service service dress clothing decoration decoration repair modification reform revolution change change change change change relocation movement movement operation operation operation performance performance effect efficiency efficiency benefit benefit benefit benefit advantage disadvantage weakness disadvantage defect defective fault problem problem difficulty dilemma adversity smooth environment situation situation interface area volume volume volume volume capacity weight quality quality quality cultivation cultivation upbringing education instruction guidance guidance leadership leadership lead command command directive instruction examination examination examination examination survey exploration exploration exploration exploration search search collection collection acquisition harvest acquisition get get get give give give give contribution contribution donation donation gift gift gift gift gift gift prize prize reward incentive incentive incentive incentive incentive incentive activate active active active leap jump jump run walk walk action behaviour behaviour stop stop stop stagnation stagnation stay stay drop drop lower elevate elevate rise sun sunshine sunshine bright bright bright bright quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality quality attitude metric measure balance smooth steady robust robust big small air climate migratory bird bird category parting leave open inspired invention star week expect treatment meet meet in front of prospective procedure sequence list example child daughter child childhood young relaxed walk pace felling wood wood mind head head bag inside inside bread parcel wrapped carry carry drive animal item quality question question question topic target standard preparation filing case exception appearance expression emotion out of control control system measure body temperature temperature degree high high low low head head top port verbal brainstorm storm storm storm rain fruit juice juice liquid sport nurturing talent talent ability strength measure action as for people people democracy main requirement requirement and and calm calm stop stopping realm realm boundaries limit definition meaning consciousness identify others human type model number dock hair development unfolding start always finally so whether or not negate definitive forum talk essay culture chemistry study habit habitual gender distinction others family population breath climate alternate complementary full meet football team team elder generation generation emergence modern representative performance singing singing song zigzag fold folding superimposed rise rise lift lower low temperature warm soft and gentle and calm peace full comprehensive noodle condition piece of matter event piece of maths study exercise work work character pattern part part break down answer promise ought to be made should of course of course however and and slowly slowly slowly slowly chronic character pattern limit limit limit limit system metric measure measure balance scale equipment material cuisine theory argument ignite burn burn destroy destroy exterminate despair see insight liberate relax loosen start always end dot dot dot dot water water bead jewellery precious valuable important point ignite flame flame flame flame flower flower blossom blossom flower hide hide hide hide anonymous name name letter letter letter letter letter letter letter letter letter letter letter letter letter letter letter close close close handle rationality pattern partial partial troopers staff tools specific experience conference argument essay article chapter holiday date expect expect looking looking at fire fire fire disaster difficult to to front back and forth back and forth back and forth return restore cause factor quality question questioning topic target goal standard preparation filing case exception appearance expression emotionally out of control control system measure body temperature temperature degree high low low head head top port verbal brainstorm storm storm storm storm rain fruit juice juice liquid sports parenting people talent talent ability strength measure action as for people people's democracy main requirement seek peace calm calmness stop stopping realm boundaries limit definition meaning consciousness identify others human type model number dock hair development unfolding start always finally so whether or not negate definitive forum talk dissertation culture chemistry learning habit habitual gender distinction others family population breath climate alternate supplement full of content football team team woo elders elders generation emerges modern representative performance singing singing song zigzag fold folding superimposed rising rising rising lowering lowering lowering low temperature gentle gentle and peaceful peaceful comprehensive noodle condition piece of matter event piece of maths learning study exercise work character pattern partial partial decomposition answer promise ought to ought to of course of course however however and slowly slowly slowly chronic character pattern limitation limitation limitation limitation system metric measure measure balance weighing weighing equipment equipment material material cooking theoretical theory theory ignition burning burning destruction destroying extinction despair see insight liberate relax loosen start always end dot dot dot water water droplet jewellery valuable precious important point ignition flame flame spark flower blossom flower hide hide hide anonymous name letter letter mother close close deal rationality pattern partial troop member employee tool specific experience conference argument essay essay chapter festival date expect hope look forward to looking fire fire disaster difficult to go back and forth back and forth back and forth back and forth back and forth Reason Factor